//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
分享到:
相关推荐
NULL 博文链接:https://hk-cxy.iteye.com/blog/941735
Ext中xtype和vtype是比较常用,本文对之进行了总结.
extjs 常用vtype 代码 Ext.VTyps常用vtype大全!
EXT表单验证之TextField,vtype 包括所有EXT中TextField的验证方式
4.7.3. 借助vtype 4.7.4. 自定义验证规则 4.7.5. 算不上校验的NumberField 4.8. 关于表单内部控件的布局问题 4.8.1. 什么都不做,默认的平铺布局 4.8.2. 分裂,分列 4.8.2.1. 分裂,分列。1.x 4.8.2.2. 分裂,分列。...
4.7.3. 借助vtype 4.7.4. 自定义验证规则 4.7.5. 算不上校验的NumberField 4.7.6. 使用后台返回的校验信息 4.8. 关于表单内部控件的布局问题 4.8.1. 什么都不做,默认的平铺布局 4.8.2. 分裂,分列 4.8.3. fieldset...
4.7.3. 借助vtype 4.7.4. 自定义验证规则 4.7.5. 算不上校验的NumberField 4.8. 关于表单内部控件的布局问题 4.8.1. 什么都不做,默认的平铺布局 4.8.2. 分裂,分列 4.8.2.1. 分裂,分列。1.x 4.8.2.2. 分裂...
ext form小例子 包括客户端验证 还有一个对Ext.form.Vtype 扩展
ext-2.3.0+CKEditor 3.0.1+ckfinder_asp_1.4配置详解 一、去http://cksource.com/下载这两个东西 二、去http://www.extjs.com/下载ext-2.3.0 三、将ext-2.3.0、CKEditor 3.0.1、ckfinder_asp_1.4,取出解压后的...
ext js的mvc框架 ,分页展示,vtype验证,border布局。新手学习ext js 不错的项目
4.1.7 Ext.form.field.Checkbox复选框和Ext.form.field.Radio单选框 4.1.8 Ext.form.CheckboxGroup和Ext.form.RadioGroup 4.1.9 Ext.form.field.Trigger触发字段 4.1.10 Ext.form.field.Spinner微调字段 4.1.11 ...
userForm = new Ext.FormPanel({ id:'conditionForm', labelWidth:'80', labelAlign:'right', border:false, bodyBorder:false, frame:true, items:[ layout:'column', items:[ { columnWidth:'.8', ...
有关于ext的xtype,Ext.QuickTips.init(),几种extjs的vtype默认支持的验证