Reputation: 2551
Does anyone know why this validation is not working, I am trying to enforce alphanumeric input of 8-12 chars but nothing is happening, I have linked to the external jquery form validation library as you can see:
<form id="userTest">
<table>
<tr>
<td>Password</td><td><input type="password" id="pwd"></input></td>
</tr>
</table>
</form>
The Jquery:
$(function(){
$("form#userTest").validate({
rules:{
pwd:{
alphanumeric: true,
minlength: 8,
maxlength: 12
}
}
});
});
Upvotes: 0
Views: 229
Reputation: 388316
you are missing the additional-methods.js file where the alpha-numeric rule is added, also you might want to add the required validation
jQuery(function ($) {
$("form#userTest").validate({
rules:{
pwd:{
required: true,
alphanumeric: true,
minlength: 8,
maxlength: 12
}
}
});
});
Demo: Fiddle
Upvotes: 1