473,387 Members | 1,757 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,387 software developers and data experts.

2 Submit Buttons Of Type Image: Which was used?

I have two buttons on my form and need to know which was
clicked. If I setup the buttons like this:

<input type="submit" value="submit" name="submit_to_array">
<input type="submit" value="submit" name="submit_to_db">

I can look in the Request.Form collection to see if
submit_to_array or submit_to_db appears to determine which
button was clicked. This works fine.

The problem is, I want to use an image instead of the
default button and I have changed the type from submit to
image, ie:

<input type="image" value="submit" name="submit_to_array"
src="images\add.gif">
<input type="submit" value="submit" name="submit_to_db"
src="images\submit.gif">

But when I do this I dont get either submit_to_array or
submit_to_db appearing in the Request.Form collection.
Where has this gone?

TIA,

Colin
Jul 19 '05 #1
2 2249
"Colin Steadman" wrote in message
news:ea****************************@phx.gbl...
: I have two buttons on my form and need to know which was
: clicked. If I setup the buttons like this:
:
: <input type="submit" value="submit" name="submit_to_array">
: <input type="submit" value="submit" name="submit_to_db">
:
: I can look in the Request.Form collection to see if
: submit_to_array or submit_to_db appears to determine which
: button was clicked. This works fine.
:
: The problem is, I want to use an image instead of the
: default button and I have changed the type from submit to
: image, ie:
:
: <input type="image" value="submit" name="submit_to_array"
: src="images\add.gif">
: <input type="submit" value="submit" name="submit_to_db"
: src="images\submit.gif">
:
: But when I do this I dont get either submit_to_array or
: submit_to_db appearing in the Request.Form collection.
: Where has this gone?

Hi Colin...

There is more than one way to accomplish this. This is one way...

Create a hidden element. If you want to use an image to submit, then add an
onclick event to an image. It doesn't have to be an input element. The
onclick event calls a script that sets the value you want to the hidden
element and then submits the form.

http://kiddanger.com/lab/form.html

Click either image to trigger the event.
Here is the code for the asp document.

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
dim submitTo
submitTo = Request.Form("submitTo")
Response.Write("You clicked: " & submitTo & vbCrLf)
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #2
Dan
All you need to do is check the x or y coordinate.

Simply:

If Request.Form("Image1Name.x") <> "" Then
...
ElseIf Request.Form("Image2Name.x") <> "" Then
...
End If

"Colin Steadman" <ms**@N0Tpart0FemailADdRESSScolinsteadman.com> wrote in
message news:ea****************************@phx.gbl...
I have two buttons on my form and need to know which was
clicked. If I setup the buttons like this:

<input type="submit" value="submit" name="submit_to_array">
<input type="submit" value="submit" name="submit_to_db">

I can look in the Request.Form collection to see if
submit_to_array or submit_to_db appears to determine which
button was clicked. This works fine.

The problem is, I want to use an image instead of the
default button and I have changed the type from submit to
image, ie:

<input type="image" value="submit" name="submit_to_array"
src="images\add.gif">
<input type="submit" value="submit" name="submit_to_db"
src="images\submit.gif">

But when I do this I dont get either submit_to_array or
submit_to_db appearing in the Request.Form collection.
Where has this gone?

TIA,

Colin

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/16/2004
Jul 19 '05 #3

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

Similar topics

3
by: Nicolas Keller | last post by:
Hi! I'm used to have Mozilla for testing my PHP sites when I'm coding. The site's nearly finished, now I've made a test with the Internet Exlporer... guess what... failed. The problem: I'm...
6
by: Adrian | last post by:
I need to have 2 submit buttons in one form calling the same page. I just need to know which was used. Being able to pass a hidden form input for each would be ideal. How can I do this?? ...
3
by: John Dunlop | last post by:
(Note crosspost and follow-ups to ciwah.) Nicolas Keller wrote in thread "Differences in form handling btw Mozilla and IE?": > The problem: I'm using a form that submit's (POST) its data via...
6
by: stellstarin | last post by:
I have a HTML page containing two submit buttons in the same form.When the form is submitted,I want to know through which submit button the form was submitted. Is there any event or property which...
5
by: Steve JORDI | last post by:
Just a question using images as submit buttons and PHP4.4.4. It seems that my code correctly works in FireFox but not in IExplorer. For example, I have a FORM with 2 buttons called "search" and...
2
by: sbettadpur | last post by:
Hi everybody, Hi iam strugling with more than one submit buttons with in one form here is my code <form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">...
1
by: sbettadpur | last post by:
Hi everybody, Iam able to getting the submition of buttons status in Mozilla but it is not working in the IE browser Iam strugling with more than 1 submit button in a single form on The IE...
7
by: Petr Vileta \(fidokomik\) | last post by:
I have a form with few text inputs. Every text input is followed by image type input. In this form I want to have 1 submit button on the top. A problem I want to resolve is: when user type...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.