anyone ever worked with the jQuery Validate Plugin.
I have like the following function.
$("#registrationForm").validate({
rules: {
'user[login]': {
required: true,
minlength: 6,
maxlength: 20
},
'user[email]': {
required: true,
email: true
},
I want to check the user[login] input for [0-9a-zA-Z-_] !
Any idea how to do so? Only alphanum -_ should be allowed.
Wow, sorry: forgot that
regexpis a custom method I’ve added in my own code!Try this:
And then:
Take a look here.
Original (wrong) answer:
I’m pretty sure you just need to add this: