[0.8.1] Combo with ForceSelection

  1. #1

    [0.8.1] Combo with ForceSelection

    Hi,
    I have a problem with the combobox in extjs 0.8.1 and 0.8.0. When I start writing in my combo the autocomplete function select the value regularly.
    If you add characters at the end of the combo with the selected value such ZZZ, start forceselection and reselect the correct value by removing ZZZ but the VALUE of the hidden field: cdMotivo_Value has the text and not the value!

    Definition of my combo:

    <ext:ComboBox ID="cdMotivo" runat="server" FieldLabel="Motivo" StoreID="dsRevocheRinunce" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="DESCRIZIONE_MOTIVO" ValueField="CODICE_MOTIVO" DataIndex="COD_MOTIVO" LoadingText="Caricamento..." IDMode="Static" FireSelect&#111;nload="true">
        <Triggers>
            <ext:FieldTrigger Icon="Clear" Qtip="Svuota Selezione" />
        </Triggers>
        <Listeners>
            <TriggerClick Handler="this.clearValue();" />
        </Listeners>
    </ext:ComboBox>

    The result to the normal selection code is as follows:

    <div style="" id="x-form-el-cdMotivo" class="x-form-element">
        <div class="x-form-field-wrap" id="ext-gen111" style="overflow: hidden; width: 877px;">
            <input type="hidden" id="cdMotivo_Value" name="cdMotivo_Value" value="4  " />
            <input type="text" id="cdMotivo" autocomplete="off" size="24" class=" x-form-text x-form-field"
                name="cdMotivo" style="width: 835px;" />
            
                <img class="x-form-trigger x-form-clear-trigger" src="/extjs/resources/images/gray/s-gif/coolite.axd"
                    ext:qtip="Svuota Selezione" id="ext-gen113" />
                <img class="x-form-trigger" src="/extjs/resources/images/gray/s-gif/coolite.axd"
                    id="ext-gen114" />
            
            <input type="hidden" name="cdMotivo_SelIndex" id="cdMotivo_SelIndex" autocomplete="off"
                size="20" class=" x-form-hidden x-form-field" value="3" />
    cdMotivo_Value = 4, OK!

    After the selection of forceselection (made by adding the suffix ZZZ):

    <div style="" id="x-form-el-cdMotivo" class="x-form-element">
        <div class="x-form-field-wrap " id="ext-gen111" style="overflow: hidden; width: 877px;">
            <input type="hidden" id="cdMotivo_Value" name="cdMotivo_Value" value="Mutate condizioni di mercato"/>
            <input type="text" id="cdMotivo" autocomplete="off" size="24" class=" x-form-text x-form-field " name="cdMotivo" style="width: 835px;"/>
            
                <img class="x-form-trigger x-form-clear-trigger" src="/extjs/resources/images/gray/s-gif/coolite.axd" ext:qtip="Svuota Selezione" id="ext-gen113"><img class="x-form-trigger" src="/extjs/resources/images/gray/s-gif/coolite.axd" id="ext-gen114" />
            
            <input type="hidden" name="cdMotivo_SelIndex" id="cdMotivo_SelIndex" autocomplete="off" size="20" class=" x-form-hidden x-form-field" value="-1">
    cdMotivo_Value is not 4 but text.

    Something wrong in the definition of my combo? I have to create a function that my system matching text with the value? I wish that I maintained the value.

    Thanks a lot for the attention,
  2. #2

    RE: [0.8.1] Combo with ForceSelection

    <div id="result_box" dir="ltr">I forgot the results I've extracted with Firebug.

    Nobody has the same problem?
  3. #3

    RE: [0.8.1] Combo with ForceSelection

    Hi,

    Can you create simple example which we can test using your steps to reproduce the issue?
  4. #4

    RE: [0.8.1] Combo with ForceSelection

    Ok,
    this is my test markup:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestForceSelectionCoolite._Default" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[]
                {
                    new object[] {"3m Co", 71.72, 0.02, 0.03, "9/1 12:00am", 1},
                    new object[] {"Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am", 2},
                    new object[] {"Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am", 3},
                    new object[] {"American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am", 4},
                    new object[] {"American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am", 5},
                    new object[] {"AT&amp;T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am", 6},
                    new object[] {"Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am", 7},
                    new object[] {"Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am", 8},
                    new object[] {"Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am", 9},
                    new object[] {"E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am",10},
                    new object[] {"Exxon Mobil Corp", 68.1, -0.43, -0.64, "9/1 12:00am",11},
                    new object[] {"General Electric Company", 34.14, -0.08, -0.23, "9/1 12:00am",12},
                    new object[] {"General Motors Corporation", 30.27, 1.09, 3.74, "9/1 12:00am",13},
                    new object[] {"Hewlett-Packard Co.", 36.53, -0.03, -0.08, "9/1 12:00am",14},
                    new object[] {"Honeywell Intl Inc", 38.77, 0.05, 0.13, "9/1 12:00am",15},
                    new object[] {"Intel Corporation", 19.88, 0.31, 1.58, "9/1 12:00am",16},
                    new object[] {"International Business Machines", 81.41, 0.44, 0.54, "9/1 12:00am",17},
                    new object[] {"Johnson &amp; Johnson", 64.72, 0.06, 0.09, "9/1 12:00am",18},
                    new object[] {"JP Morgan &amp; Chase &amp; Co", 45.73, 0.07, 0.15, "9/1 12:00am",19},
                    new object[] {"McDonald\"s Corporation", 36.76, 0.86, 2.40, "9/1 12:00am",20},
                    new object[] {"Merck &amp; Co., Inc.", 40.96, 0.41, 1.01, "9/1 12:00am",21},
                    new object[] {"Microsoft Corporation", 25.84, 0.14, 0.54, "9/1 12:00am",22},
                    new object[] {"Pfizer Inc", 27.96, 0.4, 1.45, "9/1 12:00am",23},
                    new object[] {"The Coca-Cola Company", 45.07, 0.26, 0.58, "9/1 12:00am",24},
                    new object[] {"The Home Depot, Inc.", 34.64, 0.35, 1.02, "9/1 12:00am",25},
                    new object[] {"The Procter &amp; Gamble Company", 61.91, 0.01, 0.02, "9/1 12:00am",26},
                    new object[] {"United Technologies Corporation", 63.26, 0.55, 0.88, "9/1 12:00am",27},
                    new object[] {"Verizon Communications", 35.57, 0.39, 1.11, "9/1 12:00am",28},
                    new object[] {"Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am",29}
                };
    
                this.Store1.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        
        
    
        <ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Gray" />
        <p>
            &amp;nbsp;</p>
        <p>
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="company" />
                            <ext:RecordField Name="companycode" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>
            </ext:Store>
        </p>
        <p>
            &amp;nbsp;</p>
        <p>
            &amp;nbsp;</p>
        <ext:ComboBox ID="cdMotivo" runat="server" FieldLabel="Company" StoreID="Store1"
            TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="company"
            ValueField="companycode" LoadingText="Caricamento..." IDMode="Static" FireSelect&#111;nload="true">
            <Listeners>
                <Change Handler="#{TextField1}.setValue(this.getValue())" />
            </Listeners>
            <Triggers>
                <ext:FieldTrigger Icon="Clear" Qtip="Svuota Selezione" />
            </Triggers>
            <Listeners>
                <TriggerClick Handler="this.clearValue();" />
            </Listeners>
        </ext:ComboBox>
        <ext:TextField ID="TextField1" runat="server">
        </ext:TextField>
        </form>
    </body>
    </html>
    1. Choose an element in the combobox and exit focus

    In the textbox1 appear the value of the combo.

    2. add some text in the end of combobox like "zzz" or other and exit focus

    In the textbox1 appear the TEXT of the combo.. I would appear the value


    p.s.:
    <div id="result_box" dir="ltr">sorry for my English :)





  5. #5

    RE: [0.8.1] Combo with ForceSelection

    Hi,

    In 0.8.2 version your example works correct, I think you should to wait the 0.8.2 release
  6. #6

    RE: [0.8.1] Combo with ForceSelection

    We are seeing this in 0.8.1 as well.

    Vladsch... When will the 0.8.2 be released for download from your site??
  7. #7

    RE: [0.8.1] Combo with ForceSelection

    I had a similar problem. For me, I was able to change .getValue() to .selText which seemed to return the right thing.

    I loaded mine dynamically so when I set the initial value using .setValue(), I also set .selText to that value, which prevent an error which seemed to occur if I just used .setValue().

    Not sure if this works in your situation, but maybe it will help.

    EDIT: Well, I guess since it was fixed into 0.8.2 and I see now that it was just realized, this really shouldn't be an issue

Similar Threads

  1. Replies: 6
    Last Post: Aug 25, 2011, 2:13 PM
  2. Replies: 4
    Last Post: Sep 18, 2009, 9:49 AM
  3. [CLOSED] ComboBox ForceSelection=False and Change Event
    By Steve in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 13, 2009, 2:48 AM
  4. [CLOSED] What does ForceSelection do in ComboBox?
    By harafeh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 16, 2009, 1:48 PM
  5. ForceSelection on Combo not working
    By jeybonnet in forum Bugs
    Replies: 2
    Last Post: Feb 01, 2009, 12:24 PM

Posting Permissions