Using return false; in javascript that you call from the submit button, you can stop the form from submitting.
Basically, you need the following HTML:
<form onsubmit="myFunction(); return false;"> <input type="submit" value="Submit"> </form>
Then supporting javascript:
<script language="javascript"></script>
If you wish, you can also have certain conditions for the script to submit the form:
<form onSubmit="return myFunction();"> <input type="submit" value="Submit"> </form>
Connects to:
<script language="JavaScript"></script>
Jeffrey Blake Aug 02 2018-10-02T00: 00Z
source share