2 Replies Latest reply on Jul 8, 2009 8:51 AM by RosieGp

    ComboBox and TextInput


      I have to add a change event listener... 
      I did add one something like this.... 
      Private function Change(event:Event):void{
      <mx:TextInput id="inputtxt"/>
      <mx:Button id="searchBtn" label="Search" change="Change(event)"/>
      ***This does nothing for me though***

      [Bindable] public var Emp:String;

      [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];

      This is my combobox array now I have a text box next it, so that the user can enter name, number or id...

      What should be in my change function?, I have:

      private function change():void{

                if  (cb.selectedIndex==0)


                else if (cbEmp.selectedIndex==1)





      <mx:ComboBox id="cb" dataProvider="{ary}"/>
      and how do I store what user has enter....

      which one is the right approach and how will they work... I'm just a little confused....


        • 1. Re: ComboBox and TextInput
          rtalton Level 4

          I would have a function called by the textInput's valueCommit event, and within that function append the textInput's value to that of the comboBox's value.


          Where do you store the result? It depends on what you want to do with the result. If it is something you'll need in the future, store it in a database on your server.

          • 2. Re: ComboBox and TextInput
            RosieGp Level 1

            can you show me how to incorporate valueCommit with TextInput, combobox and search and I do have to search based on what the used enter...

            So if I have



            [Bindable] public var Emp:String;

            [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];



            <mx:ComboBox id="cb" dataProvider="{ary}"/>
            <mx:TextInput id="inputtxt"/>
            <mx:Button id="searchBtn" label="Search"/>

            <mx:ViewStack id="vs">

            <src:Ref id="vsRef"/>



            Now what I want to do is when the user enter either Employee Name or Number or ID in the textInput box next to the combobox filter based on what is selected in combobox (name, number or id) I have to bring up the viewstack which shows the datagrid with data based on what the user has input...

            Can anyone help me with how do I incoprporate valueCommit or cb.selectedItem....

            I'll really appreciate that.