views:

208

answers:

1

I am trying to get the drop down list of combobox by using a php file. That php file returns an xml string which has been used as data provider for combobox.

I followed this thread too but in vain.

Details
I have set the creationComplete attribute of mx:Application to init(). In the init() function i have sent the following HTTPService

<mx:HTTPService id="interfaces" url="interfaces.php" resultFormat="e4x" method="POST"> 
 </mx:HTTPService>

Combo Box:

Update: The xml should look like

<?xml version=\"1.0\" encoding=\"utf-8\"?>
  <ifaces>
    <iface>
      <option>eth0</option>
    </iface>
    <iface>
      <option>eth1</option>
    </iface>
  </ifaces>

but if i execute interfaces.php in browser the only things that gets display is eth0eth1 whereas i am echoing the string that contains whole xml data. Shouldn't whole xml type of string display? :(

+1  A: 

The problem is that ifaces is the root element of your XML, so interfaces.lastResult == ifaces. So the XMLList you want is interfaces.lastResult.iface.

This is a whole main class that works for me:

`<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" initialize="{interfaces.send();}">

<mx:HTTPService id="interfaces" url="interfaces.xml" resultFormat="e4x" method="POST"> </mx:HTTPService>

<mx:ComboBox dataProvider="{interfaces.lastResult.iface}" labelField="option"/>

</mx:Application>`

susichan
It did not work. I actually followed following thread to solve my problem but no success yet.<br/>http://stackoverflow.com/questions/1476697/combobox-dataprovider-only-gets-labelfield-from-xml-not-the-associated-id
baltusaj
if the issue is that you can't see what your php is outputting, what do you see when you richt-click>"view source" on the php page?
susichan
Susichan, the view source showed me that my xml had some problem. I have corrected the mistake and now the life is good; :)Many thanks. :D
baltusaj