Hi guys,
I've been trying to work this out for about 7 hours - no exaggeration.
I just cannot seem to work it out :-(
I have used the sample code from "custom-methods-demo.html"
$.validator.addMethod("buga", function(value) {
return value == "buga";
}, 'Please enter "buga"!');
and I am trying to make it so i can have custom messages. Ideally like
this...
$.validator.addMethod("buga", function(value) {
var message = '';
if(value == 'word'){
message = "4 letters or more";
return false;
} else if(value == 'test'){
message = "Numbers Only";
return false;
} else if(value == 'great'){
message = "Message 3";
return false;
}else{
return true;
}
}, message);
I'm using it as follows:
rules: {
username: {
buga: true
}
}
Any help on how to do this would be great! Thanks so much for reading
this.
Many thanks.