Reputation: 8463
I am creating 10 forms dynamically
for example form would be like this
<form name="form_example" action="sample.php">
Name:<input type="text" name="name" id="name"><br />
Email:<input type="text" name="email" id="email"><br />
<input type="submit" name="save" value="Save Details">
</form>
In this way 10 similar forms in same screen and i had written only one jquery.validate function to handle all these forms dynamically.
$("form[name='form_example']").validate();
Thus the above validation code doesnt takes care of all the form validation dynamically. I dont know how to handle multiple similar form validation using single validate function.
Help me. Thanks in Advance.
Upvotes: 2
Views: 4350
Reputation: 9489
Give all your forms the same class, lets say validation. Then you could do something like
$('.validation').each( function(){
$(this).validate();
});
Now it validates all the fields when someone clicks on submit.
But rather check the manual cause everything is explained there.
Upvotes: 7