Richard Jones' Log: Double-clicking
Wed, 13 Oct 2004
Web browsers so need to filter out double-clicks on <form> submit buttons. This is just silly:
<script type="text/javascript"> submitted = false; function submit_once() { if (submitted) { alert("Your request is being processed.\\nPlease be patient."); event.returnValue = 0; // work-around for IE return 0; } submitted = true; return 1; } </script>
(The above being code that appears in Roundup, which I've added to pretty much every system I've written that has a web form in it)
That's definitely shorter :)
This sucks for large forms and bad links (dial-up, for example). Sometimes you click on button, it becomes disabled, and modem hangups or link stalls. Now you have to reload the page and start filling the form from scratch. This occurs rarely but occurs nevertheless.
How about:
input type="submit" onClick="this.value='Thinking...'; this.disabled=true;