[CLOSED] Select value of combobox on text change of textfield

  1. #1

    [CLOSED] Select value of combobox on text change of textfield

    Hi,

    I have a little panel with two textfields and a combobox:

                    <ext:Panel runat="server" ID="Panel3" FormGroup="true" Title="Search"
                      Collapsed="true" StyleSpec="padding-left: 30px">
                      <Body>
                          <ext:FormLayout runat="server" ID="FormLayout2" LabelAlign="Top">
                              <ext:Anchor>
                                  <ext:TextField runat="server" ID="Name" FieldLabel="Name" Width="215px" >
                                  <Listeners>
                                  <Change Fn="TextChange" />
                                  </Listeners>
                                  </ext:TextField>
                              </ext:Anchor>
                              <ext:Anchor>
                                  <ext:TextField runat="server" ID="Element" FieldLabel="Element" Width="215px" />
                              </ext:Anchor>
                              <ext:Anchor>
                                  <ext:ComboBox runat="server" ID="TypeCombo" FieldLabel="Type" ListWidth="215px"
                                      Width="200px" Resizable="true" />
                              </ext:Anchor>
                              <ext:Anchor>
                                  <ext:Button ID="Button1" Text="Search" runat="server" Icon="TableGo">
                                      <AjaxEvents>
                                          <Click OnEvent="DoSearch">
                                          </Click>
                                      </AjaxEvents>
                                  </ext:Button>
                              </ext:Anchor>
                          </ext:FormLayout>
                      </Body>
                   </ext:Panel>
    If somebody copies three words, seperated by '!' into the first textfield I want to split these words and set the values in the next textfield and in the combobox.

            var text = Name.getValue();
            if (text== '')
                return;
            else {
                if (text.indexOf('!') == -1)
                    return;
                var data = text.split('!');
                if (data.length == 3) {
                    Name.setValue(data[0]);
                    Element.setValue(data[1]);
                    if (data[2] == 'common')
                        TypeCombo.select(0);
                    if (data[2] == 'class')
                        TypeCombo.select(1);
                    if (data[2] == 'layout')
                        TypeCombo.select(2);
                }
            }
    I get the two words into my textfields but get the JavaScript error 'this.view is undefined' when trying to select the value of the combobox. How can I fix that?
  2. #2

    RE: [CLOSED] Select value of combobox on text change of textfield

    Hi,

    You should use 'setValue' function for combo instead 'select'


    'select' function is using to select an item in dropdown list by its numeric index (the list must be expanded)

Similar Threads

  1. Replies: 3
    Last Post: Apr 04, 2012, 10:36 AM
  2. Replies: 1
    Last Post: Mar 05, 2012, 8:59 AM
  3. Replies: 3
    Last Post: Jan 09, 2012, 12:26 PM
  4. [CLOSED] "Select..." text in ext:ComboBox
    By jsemple in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 31, 2010, 5:16 PM
  5. Replies: 12
    Last Post: Jun 17, 2009, 12:07 PM

Posting Permissions