|
Ext.application({
name: 'Demo',
appFolder: 'app',
launch: function(){
Ext.create('Ext.container.Viewport', {
margin:'100 0 0 200',
items:[{
xtype:'form',
title:'密码验证',
height: 500,
width: 700,
defaults:{
xtype: 'textfield',
width: 300,
labelWidth: 60,
margin: '20 0 0 200',
inputType: 'password',
allowBlank: false,
msgTarget: 'under'
},
items:[{
fieldLabel: '输入密码',
regex: /^([a-zA-Z0-9]{6,})$/i,
regexText: '密码必须同时包含字母和数字,且最少有6位'
},{
fieldLabel: '再次输入',
validator: function(value){
var pw = this.previousSibling().value;
if(value != pw){
return '两次输入的密码不一致';
}else{
return true;
}
}
}]
}]
});
}
});
|