Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Form question
November 24, 2004, 5:17 pm
rate this thread
I'm trying to build a form where users can optionnally enter 1 or any number
of relatives wich are to be stored separatly in a database.
I'd like to have a form wich allows the user to click on a button and it
would generate a new text box to enter this relative while the remaining
stuff stays intact.
How can I do this?
Re: Form question
This is like asking how to build a car and expecting someone how to explain
mechanical engineering to you.
Give a man a fish and he eats for a day. Teach a man to fish....
Please Support "Project Boneyard":
Re: Form question
How you approach this depends entirely upon how and where this document
will be used.
If it's for the Web, the ideal solution will provide both client- and
server-side options, where the former will fall back to the latter should
the user's browser be unable to perform the addition itself. That is,
"Add" will be a submit button. If the client-side addition succeeds, the
form submission is cancelled. Should the client-side addition fail, the
current data will be sent to the server, which will then send the page
back with a new INPUT element added.
If it's for a restricted environment where you know that a client-side
solution will always succeed, then you can just concern yourself with that.
In both cases, you'll be using the Document Object Model (DOM:
<URL:http://www.w3.org/DOM/ ) to create and then add the new element to
You can see a (very) quick and dirty implementation of the client-side
Something more refined could be made easily, but it depends on the
structure of your form.
Hope that helps,
Replace ".invalid" with ".uk" to reply by e-mail.