Marcin Stępnicki
2008-12-30 13:27:43 UTC
Hello.
I've got the following scenario:
User has to fill in some fields, but I don't know how many of them
will be necessary. Let's say:
1. Child #1 birth date: ....... (+)
---------------------------------------------
2. Child #2 birth date: .......
After clicking (+) a simple Javascript/jQuery function adds another
input field to DOM :
<input id="finish_date-1" type="text" value="" style="width: 80px;"
name="finish_date"/>
<input id="finish_date-2" type="text" value="" style="width: 80px;"
name="finish_date"/>
etc.
Unfortunately, I can't find a way to validate all fields
simultaneously. Here's a small snippet with my failed attempts:
http://pastebin.com/f12b9ea26
Just a thought: I can simply use different names for different input
fields and then perhaps somehow modify the validation schema depending
on number of fields added by the user, but it seems ugly.
Is there any hope for me? ;-)
Regards,
Marcin
I've got the following scenario:
User has to fill in some fields, but I don't know how many of them
will be necessary. Let's say:
1. Child #1 birth date: ....... (+)
---------------------------------------------
2. Child #2 birth date: .......
After clicking (+) a simple Javascript/jQuery function adds another
input field to DOM :
<input id="finish_date-1" type="text" value="" style="width: 80px;"
name="finish_date"/>
<input id="finish_date-2" type="text" value="" style="width: 80px;"
name="finish_date"/>
etc.
Unfortunately, I can't find a way to validate all fields
simultaneously. Here's a small snippet with my failed attempts:
http://pastebin.com/f12b9ea26
Just a thought: I can simply use different names for different input
fields and then perhaps somehow modify the validation schema depending
on number of fields added by the user, but it seems ugly.
Is there any hope for me? ;-)
Regards,
Marcin