I'm using jQuery Validate to validate a page with a large number of repeated rows of data. Due to limited space, each row has it's own validation summary.
I use addClassRules to apply the validation rules to the page but the default error messages are too generic in the summary (e.g. "Field is required, Field is required etc).
Example:
jQuery.validator.addClassRules({
amount: {
required: true,
range: [0, 2000000]
},
comment: {
maxlength: 51
},
owner: {
notFirstOption: true
},
A: {
required: function (element) {
return getParentElement($(element), "tr").find(".colB input.B").val().length > 0;
},
digits: true
}});
Can you apply custom messages for the rules in each validation class? Ideally I'm after something like:
jQuery.validator.addClassMessages({
amount: {
required: "Amount is required",
range: "Amount must be between 0 and 2,000,000"
},
comment: {
maxlength: "Comment may be a maximum of 51 characters"
},
owner: {
notFirstOption: "Please select an owner"
},
A: {
required: "A is required if B is entered",
digits: "A must be numeric"
}});
Thanks in advance for any help you can offer!