1 Reply Latest reply on Feb 26, 2007 1:44 PM by peterent

    HTTPService feeding ComboBox

    ChrisDut
      Hello Everybody,

      I have a problem feeding XML data in a combobox .

      <mx:HTTPService
      id="GetActivities"
      result="ShowActivities()" ( I do nothing here )
      fault="requestErrorHandler(event)"
      showBusyCursor="true"
      url= " http://localhost/party_apps/GetActivities.cfm">
      </mx:HTTPService>

      <mx:ArrayCollection id="ActivitiesList" source="{ArrayUtil.toArray(GetActivities.lastResult.activities.item)}"/>

      <mx:ComboBox dataProvider="{ActivitiesList}" labelField="description" x="544" y="63" id="Activity0" fontSize="11"/>

      <?xml version="1.0" encoding="UTF-8"?>

      <activities>
      <item>
      <ID>1</ID>
      <description>Administration / Secteur public</description>
      </item>

      <item>
      <ID>2</ID>
      <description>Associations / Fédérations / Syndicats</description>
      </item>

      <item>
      <ID>3</ID>
      <description>Automobile</description>

      </item>

      <item>
      <ID>4</ID>
      <description>Education</description>
      </item>

      <item>
      <ID>5</ID>

      <description>Energie</description>
      </item>

      <item>
      <ID>6</ID>
      <description>Immobilier / Construction</description>
      </item>

      [...]

      </activities>

      GetActivities.send() is executed on initialize of the mx:application

      My combobox gets filled with [object Object], [object Object],[object Object],[object Object],[object Object], ...

      What am I doing wrong ?
      Thanks in advance for your help, have a nice day,

      Chris.
        • 1. Re: HTTPService feeding ComboBox
          peterent Level 2
          In this case you do not want to use ArrayUtil. The result from your service is XML, not something you want to turn into an Array.

          The lastResult.activities.item is an XMLList - even if it has 1 element. That's a great parameter to give to XMLListCollection:

          <mx:XMLListCollection id="ActivitiesList" source="{GetActivities.lastResult.activities.item}" />

          Use that instead of ArrayCollection.