Stopping double clicking with Perl CGI

Smylers Smylers at
Thu May 22 10:42:40 BST 2008

Chris Jack writes:

> What is the best way of stopping a user double clicking a button in a
> web page created using Perl CGI?
> It seems to me that the logical way to do it would be to disable the
> button when it is pressed, but I haven't found an example of how to do
> that on the web yet.

That can be done straightforwardly with JavaScript, however:

* It relies on JavaScript being enabled.

* If, after submitting the form and going to the next page, the user
  decides to go back to the form (using the browser's 'Back' button) to
  change something and re-submit, the submit button will_still_ be
  disabled, which rather hampers attempts to re-submit the form -- at
  least it will in many modern browsers (Firefox 2+, Opera) which cache
  the rendered page rather than the source HTML (Firefox 1.5-).

* Disabling the button at time of form submission means the button is
  no longer in the form data-set sent to the server.  This is
  problematic if your form has multiple buttons and you want to know
  which one the user chose.


More information about the mailing list