Thank you so much. It worked :). You saved my life, thank you.

On Thu, Dec 11, 2008 at 3:32 PM, valdhor <[email protected]>wrote:

>   Try combobox.selectedit...@data
>
> --- In [email protected] <flexcoders%40yahoogroups.com>,
> samsonkiran <samsonkir...@...> wrote:
> >
> >
> > Hi
> >
> > I have an Flex file (.mxml) in which i am making the HTTPService
> call to one
> > JSP. This JSP returns me an XML data. I need to populate the
> comboBox in the
> > FLEX with the data coming from the JSP in XML format. This is the
> sample
> > code.
> >
> > test.mxml
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
> > height="100%" backgroundColor="#FFFFFF" creationComplete="srv.send()"
> > layout="absolute">
> > <mx:HTTPService id="srv" url="../test/test.jsp" resultFormat="e4x"
> result =
> > "resultHandler(event)" fault="faultHandler(event)" method="POST">
> > </mx:HTTPService>
> > <mx:ComboBox id="comboBox" width="200" labelField="@label"
> > dataProvider="{srv.lastResult.company}" change="changed()"/>
> > </mx:Application>
> > <mx:Script>
> > <![CDATA[
> > import mx.controls.Alert;
> > private function resultHandler(event:Event):void{
> > Alert.show("In Result");
> >
> > private function faultHandler(event:Event):void{
> > Alert.show(event.toString());
>
> > }
> > }
> >
> > private function changed():void{
> > Alert.show(comboBox.selectedItem.data);
> > }
> > ]]>
> > </mx:Script>
> >
> > XML Input from JSP:
> > <?xml version="1.0" encoding="utf-8"?>
> > <response>
> > <company data="c1" label="company1"/>
> > <company data="c2" label="company2"/>
> > </response>
> >
> > I am able to populate the comboBox with the data coming from the
> JSP. But
> > the problem is comboBox.selectedItem.data is not giving me any value. It
> > should give me "c1" if the "company1" and "c2" if "company2" is
> selected.
> > But it does not give me any value.
> >
> > comboBox.selectedItem.label works fine. But i need
> > comboBox.selectedItem.data for my requirement. Any idea why is this not
> > working.
> >
> > At the same if i remove the resultFormat "e4x" attribute (i.e
> working with
> > default resultFormat of Object), i am able to retrieved the selected
> value
> > using comboBox.selectedItem.data. Ofcourse the code is modified as below
> > since the format of response data is different.
> >
> >
> > <mx:HTTPService id="srv" url="../test/test.jsp" result =
> > "resultHandler(event)" fault="faultHandler(event)" method="POST">
> > </mx:HTTPService>
> > <mx:ComboBox id="comboBox" width="200" labelField="label"
> > dataProvider="{srv.lastResult.response.company}" change="changed()"/>
> >
> > Please let me know why this selectedItem.data is failing when i use e4x
> > resultFormat. Am i missing out anything? This is very urgent.
> >
> > Thanks in advance
> > --
> > View this message in context:
>
> http://www.nabble.com/ComboBox-SelectedItem-Problem-with-resultFormat-e4x---Very-Urgent-tp20964177p20964177.html
> > Sent from the FlexCoders mailing list archive at Nabble.com.
> >
>
> 
>

Reply via email to