extjs4.x How to implement the password verification function

Source: Internet
Author: User

ExtJS provides us with a complete form verification function, so that we can easily achieve a variety of form field verification, which is a little more complex password verification, today, Lee Bad on ExtJS password verification function for everyone to provide a simple demo, I hope to help.

Password authentication consists of two main elements:

1. Whether the combination of passwords meets the requirements (for example, whether it is an alphanumeric combination, etc.);
2. Two incoming passwords are consistent
The code is as follows:

The code is as follows Copy Code

Ext.application ({
Name: ' Demo ',
Appfolder: ' App ',
Launch:function () {
Ext.create (' Ext.container.Viewport ', {
Margin: ' 100 0 0 200 ',
items:[{
Xtype: ' Form ',
Title: ' Password verification ',
HEIGHT:500,
width:700,
defaults:{
Xtype: ' TextField ',
WIDTH:300,
Labelwidth:60,
Margin: ' 20 0 0 200 ',
InputType: ' Password ',
Allowblank:false,
Msgtarget: ' under '
},
items:[{
Fieldlabel: ' Enter password ',
Regex:/^ ([A-za-z0-9]{6,}) $/i,
Regextext: ' Password must contain both letters and numbers, with at least 6 digits '
},{
Fieldlabel: ' Enter again ',
Validator:function (value) {
var pw = this.previoussibling (). value;
if (value!= pw) {
Return ' two input passwords inconsistent ';
}else{
return true;
}
}
}]
}]
});
}
});

Description
1. The first time you enter a password, the regular expression to verify that the password is legitimate (you can write your own regular expression according to the actual situation)
2. The second input password, through the validator validator, to determine whether the input is consistent with the last

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.