Avatar of -Matthew-
-Matthew-

asked on 

Multiple Submit buttons

Is it possible to have two submit buttons, one that runs javascript and one that submits without running the script or just by passes the validation.

I know I could just put an image there and send them on, but if I can just say submit and move on using the same form. I guess this is more of curiosity question.

Thanks
<script type="text/javascript" language="javascript">
	function validateForm()
{
var x=document.forms["myForm"]["guardian_household"].value
var y=document.forms["myForm"]["guardian_tanf"].value
if (x==null || x=="" || y==null || y=="")
  {
  alert("All fields required.");
  return false;
  } 
  
}
</script>

<form name="myForm" action="" onsubmit="return validateForm()" method="post">
Name: <input type="text" name="guardian_household" id="guardian_household" /><br />
Tanf: <input type="text" name="guardian_tanf" id="guardian_tanf" />

<input name="answers" type="submit" class="submitbutton" id="answers" value="Submit Case Number and continue" />

<input name="answers" type="submit" class="submitbutton" id="answers" value="I Do Not Have A TANF / Food Stamp Case " />

</form>

Open in new window

JavaScript

Avatar of undefined
Last Comment
-Matthew-

8/22/2022 - Mon