Extjs verification function

Source: Internet
Author: User
How does extjs verify the password?

Implementation 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: 'The two passwords are inconsistent! '
});

========================================================== ==========

 

{
ID: 'Password ',
Name: 'Password ',
Width: 140,
Fieldlabel: '<font color = "red"> password & nbsp; Code </font> ',
// Confirmpwd :{
// First: 'Password ',
// Second: 'confirmpassword'
//},
// Inputtype: 'Password ',
// Vtype: 'confirmpwd ',
Allowblank: false,
Blanktext: 'password cannot be blank ',
RegEx:/^ [\ s] {0, 20} $ /,
Regextext: 'password length cannot exceed 20 characters'
},{
ID: 'confirmpassword ',
Name: 'confirmpassword ',
Width: 140,
Fieldlabel: '<font color = "red"> Confirm Password </font> ',
Confirmpwd :{
First: 'Password ',
Second: 'confirmpassword'
},
// Inputtype: 'Password ',
Vtype: 'confirmpwd ',
Allowblank: false,
Blanktext: 'Confirm password cannot be blank ',
RegEx:/^ [\ s] {0, 20} $ /,
Regextext: 'Confirm that the password length cannot exceed 20 characters'
}

 

Bytes -----------------------------------------------------------------------------------------------------

 

Implementation 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: 'The passwords entered twice are inconsistent! '
});

========================================================== ==========

 

{
ID: 'newpwd ',
Name: 'newpwd ',
Width: 140,
Inputtype: 'Password ',
Fieldlabel: '<font color = "red"> New Password </font> ',
Allowblank: false,
Blanktext: 'the new password cannot be blank ',
RegEx:/^ [\ s] {0, 12} $ /,
Regextext: 'the new password cannot exceed 12 characters'
},{
Name: 'confirmpwd ',
Width: 140,
Inputtype: 'Password ',
Fieldlabel: '<font color = "red"> Confirm Password </font> ',
Vtype: 'Password ',
Initialpassfield: 'newpwd ',
Allowblank: false,
Blanktext: 'Confirm password cannot be blank ',
RegEx:/^ [\ s] {0, 12} $ /,
Regextext: 'The old password cannot exceed 12 characters'
}

Ext. Apply (ext. Form. Field. vtypes ,{
Daterange: function (Val, field ){
VaR date = field. parsedate (VAL );

If (! Date ){
Return false;
}
If (field. startdatefield &&(! This. daterangemax | (date. gettime ()! = This. daterangemax. gettime ()))){
VaR start = field. Up ('form'). Down ('#' + field. startdatefield );
Start. setmaxvalue (date );
Start. Validate ();
This. daterangemax = date;
}
Else if (field. enddatefield &&(! This. daterangemin | (date. gettime ()! = This. daterangemin. gettime ()))){
VaR end = field. Up ('form'). Down ('#' + field. enddatefield );
End. setminvalue (date );
End. Validate ();
This. daterangemin = date;
}
/*
* Always return true since we're only using this vtype to set
* Min/MAX allowed values (these are tested for after the vtype test)
*/
Return true;
},

Daterangetext: 'start date must be less than or equal to end date ',

Password: function (Val, field ){
If (field. initialpassfield ){
VaR Pwd = field. Up ('form'). Down ('#' + field. initialpassfield );
Return (val = PWD. getvalue ());
}
Return true;
},

Passwordtext: 'password mismatch'
});

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.