Could I use the send/forward to essentially disable forms if I use as the `action` attribute on the form an (embed-url ...), which will no longer work later on? This will probably through an error if people do the 'Go back, resubmit' cycle, but I don't mind throwing an error on that, rather than gracefully failing. I'm not going to win any design contests that way, but solve a problem without dealing with any database interactions.
On Fri, Sep 20, 2019 at 2:03 PM Jens Axel Søgaard <jensa...@soegaard.net> wrote: > Den fre. 20. sep. 2019 kl. 13.51 skrev Marc Kaufmann < > marc.kaufman...@gmail.com>: > >> Thanks Jens, yes the send/forward seems to at least address a few of the >> cases that I have - not sure if it disallows the forms unless I use >> continuations in the forms (right now I am not, mostly just sending the >> request to the current URL. I'll have to see. >> >> Yes, I worked through and read the Continue tutorial a few times and use >> redirect/get to work around the double submit error. But -- I think -- the >> redirect/get only avoids something like refreshing the page from leading to >> a new submit, although I may be wrong. I thought I used it in some places >> where I was able to go back and resubmit. I should double check, since I am >> not using redirect/get everywhere, so that may be the issue. >> > > Yes, the redirect trick only prevents the same data (as the result of a > "submit" action) being sent twice. > If the user goes back to the form, fills in the form again and the click > submit again, a new set > of data is sent. > > If you need to prevent the same form being filled in twice, you could > associate a key as > a hidden form value (say the md5 of a counter) and keep track in a > database of which keys > have already been used. > > To prevent the key table from getting too large, you can flip it around: > keep the non-used keys in the > database, then on submission remove the key. If you also store the age of > the key, you can > from time to time delete old keys. > > /Jens Axel > > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAD7_NO5-Cz0HNMCa78rDRyRgRyNbW1C2GdFOEg-eSaSyX1XiKA%40mail.gmail.com.