Ext.apply(Ext.form.VTypes,{password:function(val,field){ if(field.confirmTo){ var pwd=Ext.get(field.confirmTo); if(val.trim()== pwd.getValue().trim()){ return true; } else { return false; } return false; } } }); //这段是必要的 { fieldLabel : '密码', id : 'password1', name : 'password', allowBlank : false, minLength : 6, maxLength : 30, inputType:'password' },{ fieldLabel : '确认密码', id : 'password2', name : 'surepassword', minLength : 6, maxLength : 30, inputType:'password', vtype:'password', vtypeText:"两次密码不一致!", confirmTo:'password1', allowBlank : false }