[thelist] POSTDATA & CFML

.jeff jeff at members.evolt.org
Mon Feb 25 18:09:08 CST 2002


carlos,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Carlos Carter
>
> So here's the problem.  I have the user submit data
> through a form and then I write a file that contains
> this data.  Finally I output it.  So the user sees the
> content of the file and then if s/he reloads the page
> this alert will pop up in NN6 for mac:
>
> "The page you are trying to view contains POSTDATA that
> has expired from cache.  If you resend the date, any
> action the form carried out (such as search or online
> purchase) will be repeated.  To resend the data, click
> OK.  Otherwise, click Cancel"
>
> If the user clicks 'OK' then the file is written again
> and the original data is appended.  This is a problem
> because this data should only be found once in the file.
> If the user clicks cancel we are led nowhere.  Does
> anybody know how to prevent this using CFML?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

fwiw, this is a problem in most every browser.

the solution is fairly straightforward -- don't send any html down the pipe
to the user in the same request that makes changes to the file system or
database.  simply redirect the user after making these changes to a page
that is set up to display the output.  now, if they click their back button
they'll be taken to the page with the form just like they will now in your
current system.  the difference is that if they reload the results page,
they won't be causing the data to be reposted as the redirect will blow that
away.

holler if you've got more questions.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list