Connecting Tech Pros Worldwide Help | Site Map

Two submit buttons within one <form>

Mike P
Guest
 
Posts: n/a
#1: Aug 14 '08
Can you have 2 submit buttons in one <formelement? 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?


*** Sent via Developersdex http://www.developersdex.com ***
Bob Barrows [MVP]
Guest
 
Posts: n/a
#2: Aug 14 '08

re: Two submit buttons within one <form>


Mike P wrote:
Quote:
Can you have 2 submit buttons in one <formelement?
I don't see why not, but I've never tried it. Why don't you try it and let
us know?
Quote:
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/h...n-another.html

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Evertjan.
Guest
 
Posts: n/a
#3: Aug 14 '08

re: Two submit buttons within one <form>


Bob Barrows [MVP] wrote on 14 aug 2008 in
microsoft.public.inetserver.asp.general:
Quote:
Mike P wrote:
Quote:
>Can you have 2 submit buttons in one <formelement?
>
I don't see why not, but I've never tried it. Why don't you try it and
let us know?
>
Quote:
>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.
>
<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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread


Similar ASP / Active Server Pages bytes