Hi, If I have a set of input text fields with the same name , for example: <input type="text name="test" value="Type your name"> <input type="text name="test" value="Type your name"> The input fields are added dynamically, so the number of the input fields is not known in advance. I want user to type something in the input fields before submission. How can I do the input data validation?
Mike, If all your INPUTs are of type "text" (i.e., no radio buttons, checkboxes, etc.), you could use GetElementsByTagName(...) to return a NodeList of all INPUT elements, then loop through them and perform validation on each one. Other than that, I'd try to come up with a scheme by which you can dynamically generate a new name for each field. You could maintain a count of INPUT fields and increment it each time you add one to the form, concatenating the last count number to the field's name. It's kind of kludgey, but it means that you can later loop through your elements more easily while still treating them as seperate entities. hth, g.