"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