The question seems simple but I cannot seem to find a solution on stackoverflow or any other source.
jQuery validation (unobstrusive) is perfect while managing fields.
Using data- on the form for example?
The real thing is that I am using MVC3 custom data annotations to generate the validation code for me.
So it would be better to only have to set an attribute on the MVC model, and to let jQuery validate handle all the checkings and generate the errors messages in the error summary.
I've seen validation for:
But nothing that handles the minimum of a collection.
no field = no validation, that's the problem I have for the moment
Everything works for the server-side, but since there is no field, there's no data.
"However, can we check a collection length with it? Using data- on the form for example?"
"no field = no validation, that's the problem I have for the moment"
The Unobtrusive Validation (powered by the jQuery Validate plugin) can only evaluate rules on the data from the following
input (various types),
So if you're looking for a way to perform validation on some other kind of element, then it cannot be done with this plugin.