|
Prevent Double Form Submits (Clicks) Using Javascript
Author: Josh Rosenbaum
Comments/Questions? Contact us here.
Introduction:
This js file will allow you to easily disable double submits of forms for a designated length of time after the first click. It will also display a countdown of the time next to the button.
Usage:
<form name="myform32">
<input value="Submit Form" name="myname" onclick="return disable_double_click(this.form.name, this, 5000);" type="submit">
</form>
Notes:
- 5000 is the time (in milliseconds) to stop double clicks on the button.
(5000 milliseconds = 5 seconds.)
- Your form must be named.
- All buttons in a form that use the safe protect code will be 'disabled' for the specified duration after the initial click.
This demo is not an actual submit, but the alerts will simulate what would happen.
If you have any modifications to make this code better, please use the InfoGears contact form.
Read the headers in the file for details.
If you want others to see this file, please link back to this page rather than copying the file to your server.
Download Version 0.2 of form_protect.js
|