Stopping double clicking with Perl CGI

David Cantrell david at cantrell.org.uk
Thu May 22 13:03:42 BST 2008


On Thu, May 22, 2008 at 10:17:52AM +0100, Chris Jack wrote:

> What is the best way of stopping a user double clicking a button in a web page created using Perl CGI? I have written "my first web app" and the logs suggest one user double clicked in well less than a second. I want a programmatic solution rather than browser configuration solution.

Include a unique ID in a hidden form field, and then on the server keep
a record of which IDs have been processed.  Ignore any requests which
have a previously seen ID in 'em.

This does, of course, assume that you don't process these requests in
parallel.  Some species of locking mechanism to enforce that should be
easy to come up with.

However, the correct solution is to cut the user's hands off.  Or if you
want a computery solution, program a Terminator to cut his hands off.

-- 
David Cantrell | Minister for Arbitrary Justice

Us Germans take our humour very seriously
  -- German cultural attache talking to the Today Programme,
     about the German supposed lack of a sense of humour, 29 Aug 2001


More information about the london.pm mailing list