Re: Preventing multiple submits
[email protected] Thu, 17 Feb 2005 10:40:24 -0800
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Andi Scharfstein, On Thu, Feb 17, 2005 at 12:39:22PM +0100, Andi Scharfstein <[email protected]> wrote: > Hi, > on my website, there is a form where users can submit data to the > site. I was just wondering if there was a simple (server-side) way to > check if the user has already submitted something and preventing him > from submitting the same thing twice (because he clicked on 'Submit' > multiple times because the site took a little longer to load, or > something along those lines). Can you achieve this in mod_ruby without > resorting to more than moderately complex measures? You could use a cookie. When form is submitted, check for cookie. If set, assume it is a resubmit. If no cookie is present, assume it is a new submit and then set a cookie to prevent another submit.