ExtJs 确认密码验证的两种实现
2011-10-31 13:24
302 查看
实现1:
*************************************************
Ext.apply(Ext.form.VTypes, {
confirmPwd : function(val, field) {
if (field.confirmPwd) {
var firstPwdId = field.confirmPwd.first;
var secondPwdId = field.confirmPwd.second;
this.firstField = Ext.getCmp(firstPwdId);
this.secondField = Ext.getCmp(secondPwdId);
var firstPwd = this.firstField.getValue();
var secondPwd = this.secondField.getValue();
if (firstPwd == secondPwd) {
return true;
} else {
return false;
}
}
},
confirmPwdText : '两次输入的密码不一致!'
});
================================================
{
id : 'password',
name : 'password',
width : 140,
fieldLabel : '<font color="red">密 码</font>',
// confirmPwd : {
// first : 'password',
// second : 'confirmPassword'
// },
// inputType : 'password',
// vtype : 'confirmPwd',
allowBlank : false,
blankText : '密码不能为空',
regex : /^[\s\S]{0,20}$/,
regexText : '密码长度不能超过20个字符'
}, {
id : 'confirmPassword',
name : 'confirmPassword',
width : 140,
fieldLabel : '<font color="red">确认密码</font>',
confirmPwd : {
first : 'password',
second : 'confirmPassword'
},
// inputType : 'password',
vtype : 'confirmPwd',
allowBlank : false,
blankText : '确认密码不能为空',
regex : /^[\s\S]{0,20}$/,
regexText : '确认密码长度不能超过20个字符'
}
-----------------------------------------------------------------------------------------------------
实现2:
*************************************************
Ext.apply(Ext.form.VTypes, {
password : function(val, field) {
if (field.initialPassField) {
var pwd = Ext.getCmp(field.initialPassField);
return (val == pwd.getValue());
}
return true;
},
passwordText : '两次输入的密码不一致!'
});
=================================================
{
id : 'newPwd',
name : 'newPwd',
width : 140,
inputType : 'password',
fieldLabel : '<font color="red">新 密 码</font>',
allowBlank : false,
blankText : '新密码不能为空',
regex : /^[\s\S]{0,12}$/,
regexText : '新密码长度不能超过12个字符'
}, {
name : 'confirmPwd',
width : 140,
inputType : 'password',
fieldLabel : '<font color="red">确认密码</font>',
vtype : 'password',
initialPassField : 'newPwd',
allowBlank : false,
blankText : '确认密码不能为空',
regex : /^[\s\S]{0,12}$/,
regexText : '旧密码长度不能超过12个字符'
}
*************************************************
Ext.apply(Ext.form.VTypes, {
confirmPwd : function(val, field) {
if (field.confirmPwd) {
var firstPwdId = field.confirmPwd.first;
var secondPwdId = field.confirmPwd.second;
this.firstField = Ext.getCmp(firstPwdId);
this.secondField = Ext.getCmp(secondPwdId);
var firstPwd = this.firstField.getValue();
var secondPwd = this.secondField.getValue();
if (firstPwd == secondPwd) {
return true;
} else {
return false;
}
}
},
confirmPwdText : '两次输入的密码不一致!'
});
================================================
{
id : 'password',
name : 'password',
width : 140,
fieldLabel : '<font color="red">密 码</font>',
// confirmPwd : {
// first : 'password',
// second : 'confirmPassword'
// },
// inputType : 'password',
// vtype : 'confirmPwd',
allowBlank : false,
blankText : '密码不能为空',
regex : /^[\s\S]{0,20}$/,
regexText : '密码长度不能超过20个字符'
}, {
id : 'confirmPassword',
name : 'confirmPassword',
width : 140,
fieldLabel : '<font color="red">确认密码</font>',
confirmPwd : {
first : 'password',
second : 'confirmPassword'
},
// inputType : 'password',
vtype : 'confirmPwd',
allowBlank : false,
blankText : '确认密码不能为空',
regex : /^[\s\S]{0,20}$/,
regexText : '确认密码长度不能超过20个字符'
}
-----------------------------------------------------------------------------------------------------
实现2:
*************************************************
Ext.apply(Ext.form.VTypes, {
password : function(val, field) {
if (field.initialPassField) {
var pwd = Ext.getCmp(field.initialPassField);
return (val == pwd.getValue());
}
return true;
},
passwordText : '两次输入的密码不一致!'
});
=================================================
{
id : 'newPwd',
name : 'newPwd',
width : 140,
inputType : 'password',
fieldLabel : '<font color="red">新 密 码</font>',
allowBlank : false,
blankText : '新密码不能为空',
regex : /^[\s\S]{0,12}$/,
regexText : '新密码长度不能超过12个字符'
}, {
name : 'confirmPwd',
width : 140,
inputType : 'password',
fieldLabel : '<font color="red">确认密码</font>',
vtype : 'password',
initialPassField : 'newPwd',
allowBlank : false,
blankText : '确认密码不能为空',
regex : /^[\s\S]{0,12}$/,
regexText : '旧密码长度不能超过12个字符'
}
相关文章推荐
- ExtJs 确认密码验证的两种实现
- ExtJs 确认密码验证的实现
- Extjs4.x Vtype扩展实现验证密码和确认密码相等
- EXTJS 密码确认与验证
- ExtJS4 如何实现密码验证
- Ext JS 中实现自定义验证 密码修改 确认密码
- Ext JS 中实现自定义验证 密码修改 确认密码
- Eureka实现Security Basic 验证(web登陆验证:输入用户名密码)
- Extjs与Struts2交互,返回JSON数据的两种实现方式
- 有关Windows免密码登陆远程桌面的两种实现方法
- EXTjs 密码验证
- 【Java系列】(五)java实现简单的窗体和密码验证(传参,事件机制和事件监听)
- 嵌入式 SSH无密码验证登录的实现
- Ext确认密码验证
- ASP.NET + EXTJS 实现类似GridView行内编辑、Pannel、分页、增删改查、数据验证,格式转换
- 正则表达式验证六位数以上数字,符号,字母任意两种混合的密码验证策略
- Android高效率编码-第三方SDK详解系列(二)——Bmob后端云开发,实现登录注册,更改资料,修改密码,邮箱验证,上传,下载,推送消息,缩略图加载等功能
- linux下实现ssh无密码验证登陆
- ssh实现多级免密码验证企业分发管理
- Oracle中的两种验证方式:操作系统验证和密码文件验证,通过操作系统验证的方式解决客户端登录不了数据的问题