Is there a simple way to change the default error values in the jQuery validation plugin?
I just want to rewrite the error messages to be more personal to my app--I have a lot of fields, so I don't want to set the message individually for field x...I know I can do that!
Another possible solution is to loop over the fields, adding the same error message to each field.
You can specify your own messages in the validate call. Lifting and abbreviating this code from the Remember the Milk signup form used in the Validation plugin documentation (http://jquery.bassistance.de/validate/demo/milk/), you can easily specify your own messages:
The complete API for validate(...) : http://jqueryvalidation.org/validate
Add this code in a separate file/script included after the validation plugin to override the messages, edit at will :)
Since we're already using JQuery, we can let page designers add custom messages to the markup rather than the code:
Or, a more general solution using a single short data-msg attribute on all fields:
And the code then contains something like this:
This worked for me:
Instead of changing the plugin source code you can include an additional js file in the format like those in the downloads localization folder and include that one after loading the validation.js