Good day. Help set Validate plugin to update user profile.
There are two input fields, "new password" and "repeat new password".
Need if they are both empty, it does not perform any checks. And if in the "Password" something entered, the password check for validity and equality of the second password.
I tried something like this, but this "if" does not work.
$.validator.setDefaults({ ignore: ":hidden:not(select)" });
$('#contact-form').validate({
rules: {
if(passord.lenght){
password: {
minlength: 6,
maxlength: 25,
required: true,
loginRegex: true
},
password_repeat: {
minlength: 6,
maxlength: 25,
required: true,
loginRegex: true,
equalTo: "#password"
}}
},
});
I was looking for the answer in similar topics, but not found.
I like the first answer, but personally would not include the
minlength: 6,
maxlength: 10
In the cfmPassword. Either the first password matches the criteria, or generates an error. If that doesn't generate an error, the second password just has to match it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With