You're not the only one having this problem: even Perlmonks suffers from it.

Basically I see 2 main approaches to prevent it:

  1. Add some form id to your form, which can be used only once. It may be just a counter value, or a random number, but you must make sure it's never used again. If your system notices a repost, thus, a form id that is used more than once in a submit, it should either reject the data, or update the data that got inserted before.
  2. Do not show your results in the same page that received and processed the data. In other words: redirect. The page that recieves the data then inserts it, and next jumps to another URL which only shows the data, and which is safe to reload. The main problem I see here is passing the status messages to the next page. Preferably, IMO, they should disappear after a reload.

Oracle appears to use yet another mechanism in their Web-PL/SQL system (as generated by Oracle Designer), in particular for updates: they add the previous values for record fields as hidden form variables, and check if these values are still the current values at the moment of the update. If not, it'll complain and refuse to do the update. That way, you cannot overwrite other people's changes by accident. Not a bad idea, IMO. (What I do find a bit odd is the name they give to this mechanism: "record locking".)


In reply to Re: Preventing Duplicates by bart
in thread Preventing Duplicates by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.