Disabling form double-submits
We can disable double submission by using the following javascript code. We can just add the following code to our submit button:
onclick=”this.disabled=true,this.form.submit();”
The javascript is executed the first time someone clicks the submit button. The first bit of code ‘this.disabled=true’ disables the button so it can’t be clicked again. The second bit of code ‘this.form.submit()’ then submits the form results (the form won’t work at all without this code).
<form>
<input type=”submit” value=”Send” onclick=”this.disabled=true,this.form.submit();”>
</form>
