We're trying to get the JQuery validate plugin working on our site but we've stumbled across a problem here.

On our site we have a login form available for the user on every page where we'd like to use the plugin to validate that the user has entered a username and password.

We also have a couple of pages showing for instance some kind of form which we'd also like to validate using the validate plugin.

The problem we've seen is that there is no way to group the username and password textbox to the login button and all the textboxes and stuff in the other form to that form's submit-button. If we'd use the ASP.NET validator we'd use the ValidationGroup attribute but I haven't found a good solution for this using JQuery yet, any help is greatly appreciated!

Best regards Martin Emanuelsson, Gothenburg, Sweden


What you need to do is call the following code where "#myForm" is the ID of the form you're trying to validate:


Your form would look like this:

     <form  id="myForm" method="get" action="">
   <input id="cname" name="name" size="25" class="required" minlength="2" />
   <input id="cemail" name="email" size="25"  class="required email" />
         <input class="submit" type="submit" value="Submit"/>

Each form you run validate() on will automatically cause validation when the submit button is clicked on it.

The problem is that in ASP.NET there is only one FORM on each page, at least only one FORM with runat="server" set. Perhaps the solution is to add one "dummy-form" per unique validation group, or is there a better or another recommended way to do this?/Martin
Martin Emanuelsson
+1  A: 

As Martin said, I am looking any other alternative way to make the group sections.

Hello, We actually ended up not using the JQuery validation plugin but instead used "old fashioned" ASP.NET Validation. However, I just found this blog post which eventually seem to have the target to address our issues with the validate-plugin so keep following the blog that you find here: regardsMartin
Martin Emanuelsson