Re: QuickForm - Preventing multiple user submissions?

From: Date: Wed, 09 Jul 2003 13:02:14 +0000
Subject: Re: QuickForm - Preventing multiple user submissions?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6540@lists.php.net to get a copy of this message
"Wolfram Kriesing" <wolfram@visionp.de> wrote in message news:3F0A5F85.6070200@visionp.de... > Graham Clarke wrote: > > Hi - anyone have a simple solution to make sure users can only submit a > > form once? Something to disable the submit after it is clicked. > > only disabling the submit button wont do i guess. since you can still > reload the page (CTRL+R in mozilla) and submit the same data again. There are two ways of submitting a form twice. One is by "back" to the page which was returned when submitting; some browsers insist on re-submitting before showing you the page again. A fix for this is, after processing the submission silently, to then issue a page redirect to the real page to be returned. Then "back" works nicely without the user being "asked" by the browser to re-submit. Twig suffered from this problem a while back and refused to fix it, instead claiming that the universal "back" button which everyone knows how to use and obviously does is is "bad". Then there is the case you mention below where you intentionally stop a form being processed twice. This is doomed to failure, the user might "back" to the form and make some changes and then re-submit what is effectively a different form which you would refuse to handle. Better to "accept" the form and offer final confirmation with that unique value based partly on the submitted contents. > What would make sense might be adding an additional hidden field to > the form, which carries a unique identifier (kind of a session-ID, > with the lifetime until the form was processed). and the form class > (QF?) knows that when this identifier's 'process()' method had been > called once it wont be called again. Therefore this unique identifier > needs to be created upon the first visit of the form page, every time. > Is this a feature which should/will go in QuickForm? YOu shouldn't try too hard to stop users submitting a form twice if they actually want to, but by all means stop them doing so accidentally, and page redirects where possible will solve that problem.

« previous php.pear.general (#6540) next »