Skip to main content
Inspiring
November 19, 2011
質問

Double Posting of forms/Two sessions

  • November 19, 2011
  • 返信数 1.
  • 738 ビュー

We have a really strange issue, wondering if anybody else has even had this

We're developing an Android app which utilizes web content from the CF8 server by using a browser that we build into the app.

The app allows end users to complete a form (from our server - just a web page really) and then post it, it's really no different than a web site.

Here's the problem, the code started to crash yet looked perfect and after some digging I found that what appeared to be happening was that the 'browser' was some how posting twice, two separate instances, I have a UUID that writes to the dbase with the record, that was unique in the TWO records that it created, I put a CFABORT at the end of the SQL insert statement, and still got two records, I also had it update a counter in the dbase, and I found that I still got two record updates, with the CFabort in place it showed that there was no code AFTER the sql that could cause it to loop back into the code, so it must be hitting the page twice (no checks for dupe records as this was not expected)

I am guessing it's the app, it doesn't happen in firefox, or the phones native web browser outside of the app.

I'm going to play around with the application.cfm which does check for a session, and if one does not exist kick the user back to the index.cfm, and also look for any initially provided URL variables and set them into the system, I am wondering if that redirect is messing it up.

Anyway, it's a strange one, thought I'd throw it out there for comments

Thanks

Mark

このトピックへの返信は締め切られました。

返信数 1

Inspiring
November 19, 2011

If the intent is to prevent duplicate records, the best place to do so is your insert query.

insert into yourTable

(fields)

select distinct values

from someSmallTable

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.

ACS LLC作成者
Inspiring
November 19, 2011

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