Hung Jung Lu wrote:
> This must be a well-known problem: you click multiple times on a form
> button, and multiple requests are send to the server. On many websites they
> ask you not to click on the "confirm purchase" button twice, because
> otherwise you'll be charged twice.

I've heard a suggestion I like a lot: send a hidden field in the form
with a random but discernably unique value.  When handling the form
submission, before performing any other processing check whether that
random value has already been copied to a small, persistent list.  If
the value is not there yet, add it and continue processing.  But if the
value is found, either stop the processing abruptly or somehow attach
to the thread which is doing the processing and return its contents
when it's finished.

Note that you should not use ZODB persistence to store the list because
each thread gets an independent view of the object database.  The
values should stay in the list for a few seconds beyond the end of the
transaction, so you'll have to implement a basic garbage collection


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to