javascript validation of control array
I am doing an application in which end user can create 'n' number of textbox on runtime. If any user will demand 'n' number of textboxex then i have used control array e.g.
Enter the data: <input type="text" name="txtData[]" id="txtData1" /><br/>
Enter the data: <input type="text" name="txtData[]" id="txtData2" /><br/>
In whole application name based validation is used (http://www.javascript-coder.com/html-form/javascript-form-validation.phtml). I am unable to validate above functionality using this validation. Is 开发者_如何学Pythonany way to validate control array?
Just a thought, does it validate when you add the correct index to you names?
Enter the data: <input type="text" name="txtData[1]" id="txtData1" /><br/>
Enter the data: <input type="text" name="txtData[2]" id="txtData2" /><br/>
And you should maybe start the numbering from 0 if want to loop more easily trough your form data after submit. So:
Enter the data: <input type="text" name="txtData[0]" id="txtData0" /><br/>
Enter the data: <input type="text" name="txtData[1]" id="txtData1" /><br/>
精彩评论