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.
Printable View
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.
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
Or you can just use two submit buttons and determine which one was clicked in the form's onsubmit event.