<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" fontSize="12" width="300" height="200">
<mx:Style>
<![CDATA[
.errorTip
{
fontSize: 12;
}
]]>
</mx:Style>
<mx:Validator id="nameV" source="{nameTI}" property="text" requiredFieldError="必须输入姓名!" trigger="{btn}" triggerEvent="click"/>
<mx:Validator id="ageV" source="{ageTI}" property="text" requiredFieldError="必须输入年龄!" trigger="{btn}" triggerEvent="click"/>
<mx:Validator id="sexV" source="{sexRBG}" property="selectedValue" requiredFieldError="必须选择性别!" trigger="{btn}" triggerEvent="click" listener="{maleRB}"/>
<mx:FormItem label="姓名:" width="150">
<mx:TextInput id="nameTI"/>
</mx:FormItem>
<mx:FormItem label="年龄:" width="150">
<mx:TextInput id="ageTI"/>
</mx:FormItem>
<mx:FormItem label="性别:" direction="horizontal" width="150">
<mx:RadioButtonGroup id="sexRBG"/>
<mx:RadioButton id="maleRB" groupName="sexRBG" label="男" value="1"/>
<mx:RadioButton id="femaleRB" groupName="sexRBG" label="女" value="0"/>
</mx:FormItem>
<mx:Button id="btn" label="提交" />
</mx:Application>
RadioButton 的检验
最新推荐文章于 2025-08-22 11:31:31 发布
本文档提供了一个使用 Flex 构建的应用程序示例,其中包括如何为表单字段设置验证器来确保用户输入的数据完整性和正确性。具体涵盖了姓名、年龄及性别等字段的验证逻辑。
2052

被折叠的 条评论
为什么被折叠?



