I am using Jquery for form validation , in that I have password and confirm password fields like this,
<input type="password" class="form-control" name="password" id="password">
<input type="password" class="form-control" name="cfmPassword" id="cfmPassword" >
Here other fields are working fine but not confirm password field,
The rule for cfmPassword
is as follow ,
password: {
required: true,
minlength: 6,
maxlength: 10
},
cfmPassword: {
required: true,
equalTo: "#password",
minlength: 6,
maxlength: 10
}
but here the problem is if cfmpassword
is not same as password
also it doesnt show error message. please any one help me in this.
working fiddle here
<form id="formCheckPassword">
<input type="password" class="form-control" name="password" id="password"/>
<input type="password" class="form-control" name="cfmPassword" id="cfmPassword" />
<input type="submit" value="submit"/>
</form>
$("#formCheckPassword").validate({
rules: {
password: {
required: true,
minlength: 6,
maxlength: 10,
} ,
cfmPassword: {
equalTo: "#password",
minlength: 6,
maxlength: 10
}
},
messages:{
password: {
required:"the password is required"
}
}
});
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