Stopping double clicking with Perl CGI

Simon Wilcox essuu at ourshack.com
Thu May 22 15:17:19 BST 2008


Chris Jack wrote:

> Oh - and given that this seems like a pretty fundamental sort of
> issue, I am disappointed that my CGI Programming with Perl doesn't
> even mention it, let alone suggest a robust solution. I am suddenly a
> lot clearer on why my online Barclays bank account prohibits hitting
> back.

The important thing to understand is that you cannot guarantee to stop 
double clicks, whatever you do. If it's important to you that you never 
handle the same request twice then you MUST deal with that on the server 
side.

The only real way to fix this is to have a unique key in the form
submission that is tested on the server side and generate some kind of 
error if the same key is seen more than once.

All the javascript in the world is only fluff to help reduce the 
likelihood of someone *accidentally* hitting submit twice. If anyone 
*wants* to hit submit twice then no amount of javascript will stop that 
happening if they're really determined enough.

Simon.


More information about the london.pm mailing list