Menu

Preventing Double Orders

The JavaScript code shown in this section prevents an order from being submitted more than once.
The key is that instead of a standard "submit" button (<input type="submit"...>), use a regular button (<input type="button"...>) that calls the "submit()" function using JavaScript.
The following code goes in the head:
<SCRIPT language="JavaScript">
<!--
var submitted = false;
function doSubmit(form) {
if (!submitted) {
submitted = true;
form.submit();
}
}
// -->
</SCRIPT>
And the following code is the generic button and function call:
<INPUT TYPE="BUTTON" VALUE="Click To Accept" NAME="submission"
ONCLICK="doSubmit(this.form)">
Back to top