Stopping double clicking with Perl CGI

David Dorward david at
Thu May 22 11:31:25 BST 2008

On 22 May 2008, at 11:18, Adam Bernard wrote:

>> For bonus points, figure out how to re-enable the button after a few
>> seconds, so that if the submit hangs and drops out they can try
>> resubmitting it.  (I have no idea if that's possible, but it would  
>> be a
>> neat solution to the main annoying problem with self-disabling submit
>> buttons)
> <input id="a" type="submit" onclick="this.disabled =
> true;setTimeout('document.getElementById(\'a\').disabled =
> false;',2000);" />
> seems to work.

eval() (and passing a string to setTimeout is an eval) considered  
harmful. There's no need for an id in this instance either.

onclick="this.disabled=true;setTimeout(function(foo){return function() 

David Dorward

More information about the mailing list