0

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 } } }); }); 

http://jsfiddle.net/zCjav/

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

thanks what a stupid error on my part. I can't believe that I used to have to write my own validation code in PHP. This is so much easier.
Alan, you'll still want to do validation in PHP - Javascript is easily disabled in the user's browser!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.