473,563 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\sub mit.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 2270
"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\sub mit.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=VBScri pt %>
<%
Option Explicit
Response.Buffer = True
dim submitTo
submitTo = Request.Form("s ubmitTo")
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("I mage1Name.x") <> "" Then
...
ElseIf Request.Form("I mage2Name.x") <> "" Then
...
End If

"Colin Steadman" <ms**@N0Tpart0F emailADdRESSSco linsteadman.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\sub mit.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
6581
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 using a form that submit's (POST) its data via three different image buttons (depending on which button you click, something different should happen):
6
5671
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?? Thanks!,Adrian
3
4338
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 three > different image buttons (depending on which button you click, > something different should happen): > > <form action="id.php" method="post"...
6
2142
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 identifies this?
5
2787
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 "save". In a second file, the one mentioned in the "action" parameter, I test which button has been clicked in order to decide which action to take....
2
1921
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();"> OFFER <input type=image src="amarok_rewind.png " title="rewind" > <input type=image src="amarok_back.png" title="back"> <input type="text" size=3...
1
1999
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 browser i need the post value status of each button here i have code please give a farward solution. Actuall i have 2 farward buttons and 2 backward...
7
1938
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 something into text input and press enter then I want to submit form by image type button but not by submit button. I tried to use tabindex parameter but...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.