我正在使用FlashBuilder 4.5 for PHP。我有一个简单的MySQL表,其中包含字段{tID,tName}。Flex - 如何将Flex DropDownList的选定项目的ID发送到服务器?
我可以像下面那样在Flex窗体中填充DropDownList。 DropDownList中显示了人的名字没有问题:
<s:Form defaultButton="{button}">
<s:FormItem label="myList: ">
<s:DropDownList id="dropDownList" creationComplete="dropDownList_creationCompleteHandler(event)" >
<s:AsyncListView list="{getPeopleResult.lastResult}"/>
</s:DropDownList>
</s:FormItem>
<s:Button id="button" label="Submit"click="button_clickHandler(event)"/>
</s:Form>
在我button_clickHandler功能,我想获得从下拉列表中选择项目的ID:
protected function button_clickHandler(event:MouseEvent):void
{
person.tID=dropDownList.selectedItem as int;
createpersonResult.token=personservice.createperson(person);
}
以上不起作用。我将不胜感激任何帮助!
你有没有尝试:person.tID = dropDownList.selectedItem为字符串; – michael