Reputation: 9575
Is there is any way to validate form using jquery on dynamic fields.
I want to make it required fields
I am creating form fields dynamically using Jsp.
like
<form name="myForm" id="myForm">
<input type="text" name="name1" value="">
<input type="text" name="name2" value="">
<input type="text" name="name3" value="">
<input type="text" name="name4" value="">
</form>
so on....
I want to validate this form fields with required form field.
Upvotes: 2
Views: 840
Reputation: 10863
Have a look at this jQuery plugin: Validation , its demo and the view source. I think you can also generate this little javascript dynamically with your form fields.
Upvotes: 3
Reputation: 1960
You could "tag" your form element with a class name like "required" in JSP. Then onSubmit you can check if any $(".required",form) has empty value.
Upvotes: 2