1 Reply Latest reply on Jan 14, 2008 9:22 AM by peterent

    Combo Box Problems

    Ronsweb
      I am populating a combo box with a remote call to a coldfusion component.
      The combo box populates, however, when I submit the form I cannot get any value.
      I created a alert box to display the value of the combo box however it will not show up with the value the the CB.
      Here is a summary of the code:

      Remote Call:
      <mx:RemoteObject id="myService" destination="ColdFusion"
      fault="Alert.show(event.fault.faultString), 'Error'" source="ACIT.formSend">
      <mx:method name="getStates" result="getStatesResult(event)" />
      </mx:RemoteObject>

      private function init(eventObj:Event):void {

      //get the state data
      myService.getStates();

      }

      private function getStatesResult(event:ResultEvent):void{
      applicant_state.dataProvider = event.result as ArrayCollection;
      }
      Function that has the alert box when the form is submitted:

      private function insertAction():void

      {

      Alert.show(applicant_state.selectedItem.data.toString());

      }

      --------------------------------------
      here is my combo box:

      <mx:ComboBox x="406" y="159" id="applicant_state" labelField="state" width="200" fontFamily="Arial" fontSize="12" color="#000000" fillColors="[#0080c0, #0080c0]" prompt="Select State"></mx:ComboBox>

      Any Help or guidance is appreciated.

      Thanks.

      Ron
        • 1. Re: Combo Box Problems
          peterent Level 2
          Use the debugger to set a breakpoint in your insertAction function. Add a local variable to make it easier to see what you are attempting to display:

          var test:Object = applicant_state.selectedItem;

          When you are in the debugger at the breakpoint, look at test - is it an Object with a "data" property? Does that property have a toString() method?