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!
The newest version has some nice in-line stuff you can do.
If it's a simple input field you can add the attribute
data-validation-error-msg
like this --If you need something a little heavier you can fully customize things using a variable with all the values which is passed into the validate function. Reference this link for full details -- https://github.com/victorjonsson/jQuery-Form-Validator#fully-customizable
I never thought this would be so easy , I was working on a project to handle such validation.
The below answer will of great help to one who want to change validation message without much effort.
The below approaches uses the "Placeholder name" in place of "This Field".
You can easily modify things
To remove all default error messages use
This worked for me:
@Josh: You can expand your solution with translated Message from your resource bundle
If you put this code part into your _Layout.cshtml (MVC) it's available for all your views
instead of these custom error messages we can specify the type of the text field.
Ex: set type of the field in to type = 'email'
then plugin will identify the field and validate correctly.