I'm using asp.net mvc 3, and I have a scenario like the one in this post JQuery Validate multiple fields with one error. I'm using the IClientValidatable since I had to create a custom validator for my scenario. But if I apply the validator to each of the properties, I will get 3 times the error message. So I know you can use groups to tell the validator to group messages for multiple fields, and I couldn't find an option to do it from C#, so I tried to do something like this:
$("#frmUser").validate({
groups: {
DateofBirth : "Year Month Day"
}
});
but the whole validation stops working, so I have the feeling that line of code overrides whatever the unobtrusive code generates. So I'm wondering if there's a way to set groups in the
validator.unobtrusive.adapters.add
or
validator.addMethod
methods.
Thanks
Something like this could help: MVC3 unobtrusive validation group of inputs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With