473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 ***
Aug 14 '08 #1
2 6445
Mike P wrote:
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?
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"
Aug 14 '08 #2
Bob Barrows [MVP] wrote on 14 aug 2008 in
microsoft.public.inetserver.asp.general:
Mike P wrote:
>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?
>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)
Aug 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Keiron Waites | last post by:
I have the following code: <input type="text" name="search" class="search_top"> <a href="" onclick="window.location='search.inc.php'+document..search. value; return false;"...
1
by: steve | last post by:
Hello, I'm reworking our company site, trying to do it without tables. It's been a bit of an... adventure. Site is starting to come along. Problem I've run into is aligning image input...
3
by: Don | last post by:
Hi all, Is there some way in a <form> tag to transfer control to a JavaScript function after completion of the submit, where the <form> and function are on the same page? I believe ONSUBMIT and...
6
by: Don | last post by:
I'm trying to come up with a way within a client-side web page of uploading a couple files to a server-side PHP program without using a <form...>. I don't want to give up the page which happens...
3
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input...
6
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to...
7
by: pamelafluente | last post by:
The precious input given by Laurent, Martin, Benjamin about XMLHttpRequest in Javascript, has made me think that perhaps I could improve what I am currently doing by using Ajax. Let's make it...
5
by: shotokan99 | last post by:
for instance i do have this element but i dont have a <form>: <input type="Text" name="myname" id="myname" size="30"...> then i have this link: echo'<a...
2
by: daveh551 | last post by:
I'm a little confused about something. I have a "Contact Us" page that I'm developing that runs within a content page under a master page. I was plagiarizing fairly liberally from some other...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.