Page 1 of 1

"Repeating" Form

Posted: Mon Dec 09, 2002 4:18 pm
by Crashin
I'm working on a form for a client that has a group of elements that may or may not be repeated by the users. As a simple example, a person might enter information for one contact and then click "Done," whereupon the form's information will be E-mailed. However, the user should also have the option to click "Add" and add another contact, as many as they'd like. When through, they can then click "Done" and all contacts will be E-mailed.

Any thoughts on how to handle this? I presume arrays are the answer, but my JS skills aren't so great regarding arrays. :?:

Posted: Mon Dec 09, 2002 5:31 pm
by volka
you might add another <input>-element to your form.
take a look e.g. at http://www.pxl8.com/innerHTML.html (DOM Compliant "innerHTML" / "innerText" for Netscape 6)

Posted: Tue Dec 10, 2002 1:42 pm
by Crashin
That's pretty slick...thanks for the link! 8)

Posted: Tue Dec 10, 2002 1:47 pm
by volka
I had to deal with some XML-dudes lately. Using the DOM-functions for creating and iterating elements was a natural choice because we could talk nearly the same language :D