On slow server or double clicks often we have double post and double comments on blogs forum, forms, uploading etc. Here is a fast JavaScript hack that can disable the Submit button after the first click. So after the users click submit, the button will be inactive for other incidental clicks. Just with adding this following line to your form inside the "input submit" tag:
onclick="myform.submit();this.disabled=true
Here is an example:
<form name=myform action="form.php" method=post"><input type="submit" value="Submit" onclick="myform.submit();this.disabled=true">
</form>
And here is a visual when I clicked on Host:
Hope you enjoy this short guide.
This article is originally from JavaScript Submit button hack | Javascript | Lirent.net Hacks | News, Reviews, Resouces and Hacks!, lirent.net/javascript/javascript-submit-button-hack.html (last visited Sep. 17, 2009) and it is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported license
Netdip.com is an excellent web site that's powered by TYPO3 and other great open source software. Netdip.com is also a fat free alternative to ice cream.
Add comment