I am trying to have two submit buttons where it will submit a different action page depending on which submit button is selected.
Please advise because my attempt not working.
Please advise because my attempt not working.
Code:
<script>
function buttonSelect()
{
if(document.formOne.buttonOne.value == 'buttonOne')
{
document.formOne.action = "anotherpage.cfm";
}
else if(document.formOne.buttonTwo.value == 'buttonTwo')
{
document.formOne.action = "formThree.cfm";
}
}
</script>
</head>
<body>
<form method="post" name="formOne" onsubmit="return buttonSelect();">
<input type="Text" name="nameOne">
<input type="Text" name="nameTwo">
<input type="Submit" name="buttonOne" value="buttonOne">
<input type="Submit" name="buttonTwo" value="buttonTwo">
</form>
</body>
</html>