There are many ways to prevent duplicate submissions. One way would be to use
javascript to reset the history so that the back button would be (sort of) disabled.
Read about that here: http://developer.irt.org/script/311.htm
Another way is to assign a unique ID ("createUUID()")to the user, carry that value
through forms and URLs, and then record the unique ID upon submitting the contents of
the form and the time it happened. Create some arbitrary number like "user cannot do
the same function twice within x seconds" and then do a date compare prior to
inserting the record to figure out if a record has been entered within x seconds by
the current user.
If you wanted, you could check all fields in the table against the form data and the
unique id to detect duplicates.
You can also use the pragma-nocache function to expire the form so that even if the
user backs up, all the contents of the form will be lost, but this doesn't work on all
browsers.
The multiple CFLOCATION trick might also work well. Use several of them so that if
the user tries to back up, they'll have to back up several times. Logic would tell
most people that if they have to back up that many times, they probably shouldn't be
doing it.
Ultimately, a user will find ways to get around all this, but I think you're simply
trying to avoid mistakes, and a combination of all of the above will most likely
reduce that error ratio down considerably.
---mark
--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Fax: (714) 972-2181
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 17, 2001 7:25 AM
> To: CF-Talk
> Subject: duplicating inserts
>
>
> Anyone know of a way to stop records from being reinserted into a
> database when a user hits the back button? I have a page that checks
> for duplications in a database, and if it finds no duplicate, then it
> will insert it into the database. Problem is, when a user hits the back
> button, it inserts the record again. Its not finding duplicates more
> than likey because the query is being cached so it doesnt know to look
> again. But how can I get it to either do nothing including not
> inserting the record a second time or atleast recheck again to see if
> its a duplicate record? I can't take caching off this machine as these
> are some monster queries and performance is greatly improved by caching
> queries.
>
> Thanks
>
> ***********************************
> Misty Woodward
> ODS Decision Support
> tel: 913.315.6583
> email: [EMAIL PROTECTED]
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists