in reply to Re^3: (CGI) Prevent a reload from resubmitting a form
in thread (CGI) Prevent a reload from resubmitting a form

I know that i have to validate the data never the less.
My original Question was why this "accidental reloads" happen at all. There should be no need to hide the button if the script would work correctly.

Im trying to catch the "real" reloads because i dont want my users to accidently change configuration options for example, and not because they are only allowed to submit somthing to db for just one time in a session. This works well, i just have to fix the "accidental reloads".

regards.
  • Comment on Re^4: (CGI) Prevent a reload from resubmitting a form

Replies are listed 'Best First'.
Re^5: (CGI) Prevent a reload from resubmitting a form
by mzedeler (Pilgrim) on Jun 27, 2009 at 20:06 UTC

    The reload-detection mechanism is probably triggered because one of the requests sent by the browser succeeds in updating the session, and the final request compares the session and the submitted value to find that they are identical.

    You can't expect that nothing has changed, just because a request is cancelled when the user clicks the submit-button again. The server may be done with the first request by the time it receives the second.

    I wouldn't rely on any mechanism to distinguish between the rapid re-submitting of a request and submitting once followed by a reload a while later.