PDA

Click to See Complete Forum and Search --> : multiple submit button - asp


simonmay
Jul 12th, 2000, 01:31 PM
I have a html form with, suppose, 3 submit buttons,how do i proceed to know (on the server side) wich one has been pressed ?

dvst8
Jul 12th, 2000, 01:55 PM
use the onmousedown event of each button to fill a hidden form field with a string which identifies the button. then you can retrieve this hidden field upon submission.

dvst8

simonmay
Jul 12th, 2000, 02:00 PM
thank you dvst8

dvst8
Jul 12th, 2000, 02:24 PM
i figured out how to do this 2 days ago :)

Mark Sreeves
Jul 13th, 2000, 02:18 AM
But some browsers don't support onmousedown

Yoiu could do somthing like this though:


<%@ Language=VBScript %>
<HTML>
<HEAD>

<script language='Javascript'>
function postit(str){

document.frm1.txtKey.value=str;
//alert(str);
document.frm1.submit();
}
</script>
</HEAD>
<BODY>
<%
Response.Write request("txtKey") & " was pressed"
%>
<form name="frm1" action="ch.asp"><!--POST BACK TO ITSELF -->
<input type=hidden name="txtKey">

<INPUT type=button onclick="postit(this.name);" name="button1" value="button1">
<INPUT type=button onclick="postit(this.name);" name="button2" value="button2">
</form>
</BODY>
</HTML>