I read this into jquery website:
message (Optional) String, Function
The default message to display for this method. Can be a function created by jQuery.validator.format(value). When undefined, an already existing message is used (handy for localization), otherwise the field-specific messages have to be defined.
I have added a method like this:
$.validator.addMethod("postalCode", function(value, element) {
return this.optional(element) || /^[0-9\-]+$/i.test(value);
});
Then, on my localization file I have:
postalCode: jQuery.validator.format("blabla")
However, "blabla" is never assumed.
I've also tried to pass jQuery.format() as a message argument:
$.validator.addMethod("postalCode", function(value, element) {
return this.optional(element) || /^[0-9\-]+$/i.test(value);
}, jQuery.format());
No luck either.
How is this suppose to work?
Thanks a lot, MEM