Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 14th, 2008, 10:05 AM
Mike P
Guest
 
Posts: n/a
Default Two submit buttons within one <form>

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 ***
  #2  
Old August 14th, 2008, 02:15 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default 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"


  #3  
Old August 14th, 2008, 03:15 PM
Evertjan.
Guest
 
Posts: n/a
Default 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)
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles