PDA

Click to See Complete Forum and Search --> : 2 submit buttons on one form


nutstretch
Dec 8th, 2000, 04:22 AM
I have a form in which the user chooses a record and then decides whether to edit or delete the record. How can i put two submit buttons pointing to two different forms on one form.

Ianpbaker
Dec 8th, 2000, 04:55 AM
you can do something like this

<HTML>
<HEAD>
<SCRIPT language="javascript">
function changeSubmit(formnum)
{
if (formnum == 1)
{
document.myform.action = "page1.asp";
document.myform.submit();
}
if (formnum == 2)
{
document.myform.action = "page2.asp"
document.myform.submit();
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="myform">
<INPUT type="button" value="edit" onclick="changeSubmit(1);">
<INPUT type="button" value="Delete" onclick="changeSubmit(2);">

</FORM>
</BODY>
</HTML>

hope this helps

Ian

monte96
Dec 8th, 2000, 08:47 AM
Or you can just use two submit buttons and determine which one was clicked in the form's onsubmit event.