If the intent is to prevent duplicate records, the best place to do so is your insert query.
insert into yourTable
select distinct values
where not exists
(stuff for duplicate records goes here)
Then it doesn't matter how the attempt is made.
As far as the double form submission goes, I've seen something similar. We used to get a double page request without a form scope at all. It was intermittent and we never did figure it out. It does not appear to be happening to us anymore.
unfortunately it's a set of pages that the user continues to loop through as they complete various forms for our advertisers offers, the list of forms is descreased in a list that is held in a session, amongst other changes to the sessions. The page that is 'visible' is the 'second' one, so the first hit writes the record, does it's thing with the sessions, so when the visible page hits the server it crashes because the session variables were changed by the first invisible hit.
Not only does this happen on form submits, but even on the initial page which serves the offer list to them, no submit on there, and like you it appears to be intermitant
After taking a bit of a break from this because it was driving me nutts! I went back to the very beginning and did unearth a clue, what it tells me I'm not sure.. CF or App issue, not quite sure still..But check this out.
My application.cfm file sets up the session, as below:
sessionTimeout="#createTimeSpan(0, 0, 30, 0)#"
<!---// make sure cookies expire when the user closes their browser //--->
<cfif structKeyExists(cookie, "cfid") and structKeyExists(cookie, "cftoken")>
<cfset localCFID = cookie.cfid />
<cfset localCFTOKEN = cookie.cftoken />
<!---// reset the cookies //--->
<cfcookie name="CFID" value="#localCFID#" />
<cfcookie name="CFTOKEN" value="#localCFTOKEN#" />
<CFIF NOT #IsDefined('session.aff')#>
<CFSET session.aff="0"><CFLOCATION URL="index.cfm"></CFIF>
Is checks to see if a sessoin has already been established, if not it includes the defautvariables.cfm template which basically just looks for a few URL variables initially passed to the server from the app (the app goes to index.cfm first shot with some variables), the variables are set into the session and then the code redirects back to index.cfm. I have to have the redirect because the rest of the pages need to have a session, so if session.aff is missing, it'll kick back to the index.cfm from any point. One thought is to do away with that and put all the other active pages in their own directory, but I'm not sure I'll benefit from that.
Anyway, when the app hits the index.cfm page, without a session established, I get a double hit on the server, it clocks up two of everything, but when I go back to is with the session active, one hit, if I close the app, clear the session go back again, same thing, 2 hits, now this is just this page, not sure why the other pages are doing it further down the road, but perhaps this initial 'confusion' brought on either in the app or in the CF is causing it to go wrong further down the road.
I may try breaking it all apart so it hits the index.cfm, checks the session and if there isn't one, create and check for url variables, then when it's done, kick over to another page in a sub folder with all of the other files.. then the application in the sub folder just checks for the session.aff and if not present kicks back to the index.cfm, the only advantage with that is that I can stop the page redirecting back to itself, the initial index.cfm.. purely experimental, surely what I have should work.