默认的是“必须填写”验证。
如果改为其他方式,则修改下就可以了,详细可以见帮助文件。
格式:
var sprytextfield1= new Spry.Widget.ValidationTextField("WidgetContainerID", "ValidationType", {option1:"value1", option2:"value2", ..});
</script>
以email为例:
var sprytextfield1= new Spry.Widget.ValidationTextField("sprytextfield1", "email");
| 
 Option  | 
 Value  | 
|---|---|
| 
 format  | 
|
| 
 validateOn  | 
 事件响应可以是["blur"]也可以是 ["change"],或者两者都(["blur", "change"])  | 
| 
 isRequired  | 
 true (默认); false  | 
| 
 useCharacterMasking  | 
|
| 
 minChars/maxChars  | 
 最小字符数 / 最大字符数  | 
| 
 minValue/maxValue  | 
 最小数值 / 最大数值  | 
| 
 pattern  | 
| 
 Validation type  | 
 Format  | 
|---|---|
| 
 none  | 
 不是必须的.  | 
| 
 integer  | 
 文本域仅仅只接受数字类型的值  | 
| 
 | 
 文本域只接受含有@和.的email地址  | 
| 
 date  | 
 日期验证,格式:mm/dd/yy  | 
| 
 time  | 
 时间验证,日期+HH:mm(分,秒)  | 
| 
 credit_card  | 
 身份证明验证  | 
| 
 zip_code  | 
 邮编,适合美国.和加拿大的邮编格式  | 
| 
 phone_number  | 
 电话号码验证,适合美国.和加拿大的电话格式 (000) 000-0000  | 
| 
 social_security_number  | 
 安全编号类型验证  | 
| 
 currency  | 
 货币格式,如: 1,000,000.00 or 1.000.000,00.  | 
| 
 real  | 
 实数验证  | 
| 
 ip  | 
 IPv4, IPv6这或者两种IP地址.  | 
| 
 url  | 
 网址验证,如 http://xxx.xxx.xxx, https://xxx.xxx.xxx, 或 ftp://xxx.xxx.xxx.  | 
| 
 custom  | 
自定义格式 | 
| NDF网站建设淘宝店 | 联系我们 | 
| ©2007-2025 NDF Corporation |