Multiple actions from a single Form

by Francis 2013-10-30 12:19:19

Multiple actions from a single Form
One form multiple action (submit) could write in javascript

Html Code
<form name="Form1" method="post">
Enter Your Name <input type="text" name="text1" size="10" /><br />
<INPUT type="button" value="Button1" name=button1 onclick="return OnButton1();">
<INPUT type="button" value="Button2" name=button2 onclick="return OnButton2();">
</form>

Javascript Code
<script language="Javascript">
function OnButton1()
{
document.Form1.action = "Page1.php"
document.Form1.submit(); // Submit the page
return true;
}

function OnButton2()
{
document.Form1.action = "Page2.php"
document.Form1.target = "_blank"; // Open in a new window
document.Form1.submit(); // Submit the page
return true;
}
</script>

885
like
0
dislike
0
mail
flag

You must LOGIN to add comments