加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex 一些数据的验证(邮箱,字符串,日期,年龄,性别)

发布时间:2020-12-15 04:08:27 所属栏目:百科 来源:网络整理
导读:1. 邮件验证 mx:EmailValidator ? ? ? ? ? ? ? ?id="emailV" ? ? ? ? ? ? ? ?source="{txtEmail}" ? ? ? ? ? ? ? ?property="text" ? ? ? ? ? ? ? ?invalidCharError=" 非法字符 " ? ? ? ? ? ? ? ?invalidDomainError=" 非法域 " ? ? ? ? ? ? ? ?invalidIPDo
1.邮件验证
<mx:EmailValidator
????????id="emailV"
????????source="{txtEmail}"
????????property="text"
????????invalidCharError="
非法字符"
????????invalidDomainError="
非法域"
????????invalidIPDomainError="
非法IP"
????????missingAtSignError="
缺少@"
????????missingPeriodInDomainError="
缺少域后缀"
????????missingUsernameError="
缺少用户名"/>

2.
字符串长度验证
<mx:StringValidator source="{fname}" property="text"
????????tooShortError="
字符串太短了,请输入最少4个字符. "
????????tooLongError="
字符串太长了,请输入最长20个字符. "
????????minLength="4" maxLength="20"
????????trigger="{myButton}" triggerEvent="click"
????????valid="Alert.show('
字符串格式正确!');"/>??

3.
日期验证
<mx:DateValidator source="{txtDate}" property="text"
????????required="true" requiredFieldError="
请输入日期"
????????allowedFormatChars="-" inputFormat="YYYY-MM-DD"
????????trigger="{btnSubmit}" triggerEvent="click"
????????valid="mx.controls.Alert.show('
验证成功');"
????????invalid="mx.controls.Alert.show('
验证失败');"
????????wrongDayError="
日输入错误"
????????wrongMonthError="
月输入错误"
????????wrongYearError="
年输入错误"
????????wrongLengthError="
日期长度错误"
????????invalidCharError="
日期分隔符错误"
????????formatError="inputFormat
?配置错误"/>

4.
英文字母验证
?<mx:RegExpValidator?id="regExpValidator"?
????????source
="{txtInput}"?property="text"?
????????flags
="g,i"?expression="^[a-z]+$"?
????????valid
="handleResult(event)"?invalid="handleResult(event)"
????????trigger
="{btnSubmit}"?triggerEvent="click"
????????noMatchError
="
请输入正确的英文字母"
????????required
="false"/>
5.年龄验证
<mx:NumberValidator id="ageV" source="{ageTI}" property="text"
????domain="int"
????minValue="6"
????maxValue="100"
????lowerThanMinError="
年龄过小!"
????exceedsMaxError="
年龄过大!"
????integerError="
年龄必须是整数!"
????invalidCharError='
输入了非数字字符!'
????requiredFieldError="
必须输入年龄!"
????trigger="{btn}" triggerEvent="click"/>

6.
性别验证
<mx:Validator id="sexV" source="{sexRBG}" property="selectedValue"
????requiredFieldError="
必须选择性别!"
????trigger="{btn}" triggerEvent="click"
????listener="{maleRB}"/>
???<mx:FormItem label="
性别:" direction="horizontal" width="200">
????????<mx:RadioButtonGroup id="sexRBG">
????????????<mx:RadioButton id="maleRB" groupName="sexRBG" label="
" value="1"/>
????????????<mx:RadioButton id="femaleRB" groupName="sexRBG" label="
" value="0"/> ????????</mx:RadioButtonGroup> ???</mx:FormItem>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读