May 07, 2009, 12:19 PM
[CLOSED] Select value of combobox on text change of textfield
Hi,
I have a little panel with two textfields and a combobox:
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?