我正在为 PHP 使用 FlashBuilder 4.5。我有一个简单的 MySQL 表,其中包含字段 {tID, tName}。
我能够在 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.tID as int;
dropDownList.selectedItem
的直接值可能是“[Object]” - 很可能是一个 person
对象,其字段为 tID
和 tName
.
这是我根据目前看到的代码做出的猜测...:)
关于php - Flex - 如何将 Flex DropDownList 的所选项目的 ID 发送到服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6733794/