Ext vtype

//form验证中vtype的默认支持类型
1.alpha //只能输入字母,无法输入其他(如数字,特殊符号等)
2.alphanum//只能输入字母和数字,无法输入其他
3.email//email验证,要求的格式是"langsin@gmail.com"
4.url//url格式验证,要求的格式是http://www.langsin.com

密码验证的例子:
Ext.apply(Ext.form.VTypes,{
password:function(val,field){

if(field.confirmTo){

var pwd=Ext.get(field.confirmTo);

return (val==pwd.getValue());
}
return true;
}
});


items:[ {fieldLabel:"密码",
id:"pass1",
anchor:"90%"
},
{
fieldLabel:"确认密码",
id:"pass2",
vtype:"password",
vtypeText:"两次密码不一致!",
confirmTo:"pass1",
anchor:"90%"
}


下面是API文档:
Properties Methods Events Direct Link
Class Ext.form.VTypes
Package: Ext.form
Defined In: VTypes.js
Class: VTypes
Extends: Object
* This is a singleton object which contains a set of commonly used field validation functions. The validations provided are basic and intended to be easily customizable and extended. To add your own custom VType:

Ext.apply(Ext.form.VTypes, {
IPAddress: function(v) {
return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
},
IPAddressText: 'Must be a numeric IP address'
});


This class is a singleton and cannot be created directly.
Public Properties
Property Defined By
alphaMask : RegExp
The keystroke filter mask to be applied on alpha input
VTypes
alphaText : String
The error text to display when the alpha validation function returns false
VTypes
alphanumMask : RegExp
The keystroke filter mask to be applied on alphanumeric input
VTypes
alphanumText : String
The error text to display when the alphanumeric validation function returns false
VTypes
emailMask : RegExp
The keystroke filter mask to be applied on email input. See the email method for information about more complex ema...
The keystroke filter mask to be applied on email input. See the email method for information about more complex email validation.
VTypes
emailText : String
The error text to display when the email validation function returns false
VTypes
urlText : String
The error text to display when the url validation function returns false
VTypes
Public Methods
Method Defined By
alpha( String value ) : void
The function used to validate alpha values
The function used to validate alpha values
Parameters:

* value : String
The value

Returns:

* void

VTypes
alphanum( String value ) : void
The function used to validate alphanumeric values
The function used to validate alphanumeric values
Parameters:

* value : String
The value

Returns:

* void

VTypes
email( String value ) : void
The function used to validate email addresses. Note that this is a very basic validation -- complete validation per ...
The function used to validate email addresses. Note that this is a very basic validation -- complete validation per the email RFC specifications is very complex and beyond the scope of this class, although this function can be overridden if a more comprehensive validation scheme is desired. See the validation section of the Wikipedia article on email addresses for additional information.
Parameters:

* value : String
The email address

Returns:

* void

VTypes
url( String value ) : void
The function used to validate URLs
The function used to validate URLs
Parameters:

* value : String
The URL

Returns:

* void
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值