1 Reply Latest reply on Dec 14, 2007 12:07 PM by ChrisAtLifeCare

    Populate one combobox based on selection of another

    ChrisAtLifeCare
      Hello all,

      I have a combobox that is dynamically populated. I want to fill another combox based on the selected item from the first combobox. I am using PHP to handle the connection to the database. The combo box cbDivision populates just fine.

      Can someone point me in the right direction?

      Here is my code:
      [Bindable]
      public var selectedItem:Object;

      [Bindable]
      private var datalist:ArrayCollection;
      private function resultHandler(event:ResultEvent):void{
      datalist = event.result.data.row;
      }
      [Bindable]
      private var datalist2:ArrayCollection;
      private function resultHandler2(event:ResultEvent):void{
      datalist2 = event.result.data.row;
      }

      <mx:HTTPService url=" http://127.0.0.1/getDivisions.php"
      id="xmlGetDivisions"
      showBusyCursor="true"
      result="resultHandler(event)"
      method="GET" />

      <mx:HTTPService url=" http://127.0.0.1/getFacilities.php"
      id="xmlGetFacilities"
      showBusyCursor="true"
      result="resultHandler2(event)"
      method="POST">
      <mx:request xmlns="">
      <DivisionValue>
      {selectedItem.Division}
      </DivisionValue>
      </mx:request>
      </mx:HTTPService>

      <mx:ComboBox x="116" y="60" id="cbDivision" editable="false" enabled="true" prompt="Please Select" close="selectedItem=ComboBox(event.target).selectedItem, xmlGetFacilities.send();" initialize="getDivisions()" dataProvider="{datalist}" labelField="Division">
      </mx:ComboBox>

      <mx:ComboBox x="413" y="60" id="cbFacility" editable="false" enabled="true" initialize="xmlGetFacilities.send();" prompt="Please Select" dataProvider="{datalist2}" labelField="Name"></mx:ComboBox>


      Thank you in advance!