PDA

View Full Version : ComboBox with TextArea


murad898
06-30-2008, 12:54 PM
Hi,

I’m looking for your help… please?

I have on flex file that consist of:
- ComboBox --> id=”com1” with dataprovidor =”{webService}” labelField =”FirstName”

- TextArea --> id = “txt1”


The web service list 10 Names…

I want to print the name in the TextArea after I choose it from the ComboBox..

corbo950
06-30-2008, 03:46 PM
<mx:Script>
<![CDATA[
public function selectName():void{
txt1.text=com1.selectedItem.FirstName;
}
]]>
</mx:Script>
<mx:ComboBox id= "com1" dataprovidor = "{webService}" labelField = "FirstName" close= "selectName()"/>
<mx:TextArea id= "txt1"/>


Your Welcome

murad898
07-01-2008, 06:17 AM
Thankxxxx a lot, I used your code and it is working.

May I ask one more thing..

Suppose that my websirvece return FirstName and ID# for 10 users,,, in the ComboBox we already showed the FirstName.
I need to show the ID# in the TextArea for any choosen user name from the ComboBox.

It means that whenever I choose the FirstName from the ComboBox I will see its correspond ID in the TextArea.

murad898
07-01-2008, 06:43 AM
Thankxxx a lot...

I got it.... Many Thanks

kminev
07-01-2008, 07:16 PM
How did you get the ID value I am working on similar problem. Is there a property for text and value on the combo box?

murad898
07-03-2008, 08:31 AM
You can use this,
txt1.text=com1.selectedItem.ID;


this one will work
ComboBox.selectedItem.[any XML node]