1 Reply Latest reply on Mar 20, 2008 9:28 AM by Gregory Lafrance

    ComboBox - Data-value pairs

    Frank_Phillips
      All,

      Flex newbie here... I have been frustrated by Flex's ComboBox not being able to natively handle code/label pairs like simple HTML does via a select control. I am using an XML return via a PHP HTTPService call. The XML has both a code and label attribute and supports three linked ComboBox controls. The user needs to see the label but my database calls need to be passed the related code value. Is this doable? I can restructure the XML as needed. Thanks

      Frank
        • 1. Re: ComboBox - Data-value pairs
          Gregory Lafrance Level 6
          This may get you started:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:Panel x="10" y="10" width="350" height="200" title="Rate Customer Service">
          <mx:ComboBox id="cbxRating" x="20" y="20" width="100">
          <mx:dataProvider>
          <mx:Array>
          <!-- These Object tags replace the String tags. -->
          <mx:Object label="Satisfied" data="5"/>
          <mx:Object label="Neutral" data="3"/>
          <mx:Object label="Dissatisfied" data="1"/>
          </mx:Array>
          </mx:dataProvider>
          </mx:ComboBox>
          <mx:Button x="140" y="20" label="Send"/>
          <mx:Label x="20" y="120" text="{cbxRating.value}"/>
          </mx:Panel>
          </mx:Application>