Reputation: 17498
If all asp.net controls are required to be within a form in order to be generated, how does one go about using the jquery validation plugin with multiple forms on the same page?
What I mean by that is, how can I have two forms both containing asp controls that can be validated independently with jquery validation?
Upvotes: 0
Views: 1005
Reputation: 14618
The problem here is you want two forms in the first place. ASP.NET, as far as I know, forces you to put all your controls in a single form.
So nevermind the validation at all. The jQuery validation would be easy (See Craig's answer). The two forms in ASP.NET is a different story.
You could probably hack it with iframes or something, but I'd advise against it.
Upvotes: 1
Reputation: 126547
Validate all of them:
$("form").validate();
...or only forms with a certain class:
$("form.validateMe").validate();
Upvotes: 1