Form question

F

Frankster

Hello,

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?

Using HTML, Javascript or vbscript, ASP...

Thanks.

Francois
 
K

Karl Core

Frankster said:
Hello,

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?

Using HTML, Javascript or vbscript, ASP...

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....

http://www.w3.org/TR/REC-html40/interact/forms.html
http://www.w3schools.com/html/html_forms.asp
http://www.htmlhelp.com/faq/html/forms.html

http://www.w3schools.com/asp/default.asp
http://www.asp101.com/
http://www.aspronline.com/learn/
 
N

Neal

Karl said:
This is like asking how to build a car and expecting someone how to
explain
mechanical engineering to you.

Or as I jokingly asked a cute girl in high school who played saxophone:

"Can I ask you a question?"

"Sure..."

"How do you play the sax?"
 
D

Duende

While sitting in a puddle Neal scribbled in the mud:
Or as I jokingly asked a cute girl in high school who played saxophone:

"Can I ask you a question?"

"Sure..."

"How do you play the sax?"

Was she impressed?
 
F

Frankster

Karl Core said:
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....

http://www.w3.org/TR/REC-html40/interact/forms.html
http://www.w3schools.com/html/html_forms.asp
http://www.htmlhelp.com/faq/html/forms.html

http://www.w3schools.com/asp/default.asp
http://www.asp101.com/
http://www.aspronline.com/learn/

Maybe it wasnt clear but I didn't ask about building the whole form, I know
how to do that.

I was asking specifically about adding a new text box at the press of a
button.

I couldn't find anything about that in your links.

Got some more?
 
N

Neal

rf said:
What are you doing calling me a brit? I'm on the other side of the planet
from those bastards -)

Not you, directed to the general audience. But you do still talk funny...
 
M

Michael Winter

[snip]
I was asking specifically about adding a new text box at the press of a
button.

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
the form.

You can see a (very) quick and dirty implementation of the client-side
implementation at
<URL:http://www.mlwinter.pwp.blueyonder.co.uk/ah/frankster/add-box.html>.
Something more refined could be made easily, but it depends on the
structure of your form.

Hope that helps,
Mike
 
F

Frankster

Thanks alot Micheal! You gave me what I needed to be on the right track and
more.

Have a nice day.

Michael Winter said:
[snip]
I was asking specifically about adding a new text box at the press of a
button.

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
the form.

You can see a (very) quick and dirty implementation of the client-side
implementation at
<URL:http://www.mlwinter.pwp.blueyonder.co.uk/ah/frankster/add-box.html>.
Something more refined could be made easily, but it depends on the
structure of your form.

Hope that helps,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top