Two submit buttons within one <form>

M

Mike P

Can you have 2 submit buttons in one <form> element? I have a form with
a few dropdowns and textboxes that has a submit button to write the data
to a database, but I also need a submit button next to one of the
dropdowns to respond to whatever has been selected in the dropdown,
which will then populate one of the text boxes. How can I do this?
 
B

Bob Barrows [MVP]

Mike said:
Can you have 2 submit buttons in one <form> element?

I don't see why not, but I've never tried it. Why don't you try it and let
us know?
I have a form
with a few dropdowns and textboxes that has a submit button to write
the data to a database, but I also need a submit button next to one
of the dropdowns to respond to whatever has been selected in the
dropdown, which will then populate one of the text boxes. How can I
do this?
Well, a second submit button will submit the same form as the first one, so
you will need to provide some way for the target page to tell whether to
simply provide the information for your cascading dropdown or to write the
data to the database.

See here for some alternative approaches:
http://classicasp.aspfaq.com/forms/how-do-i-make-one-dropdown-depend-on-another.html
 
E

Evertjan.

Bob Barrows [MVP] wrote on 14 aug 2008 in
microsoft.public.inetserver.asp.general:
I don't see why not, but I've never tried it. Why don't you try it and
let us know?

Well, a second submit button will submit the same form as the first
one, so you will need to provide some way for the target page to tell
whether to simply provide the information for your cascading dropdown
or to write the data to the database.

<f...='post'.....
<input type='submit' name='mySubmit' value='number1'>
<input type='submit' name='mySubmit' value='number2'>

............

<%
if request.form("mySubmit")="number1" then
'' first one pressed
elseif request.form("mySubmit")="number2" then
'' other one pressed
else
'' possibly js triggered: d...form[x].submit();
end if

not tested
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top