Take Joachim's advice on this one (never a bad idea to begin with) and assume that someone will use the back button and trap the error!
Here are a few ideas you can consider on the server side:
1) Create a session variable if the person has added a record. When you have finished the process delete the session variable. If someone uses the back button, having the session variable in hand, you can now handle the situation.
2) When inserting data into the database, check to see if the information has been entered correctly into the database. If it has, then stop the database transaction.
3) Surround the transaction with cftry/cfcatch to check if someone is entering the form with the wrong information. If this is the case then someone is accessing the information through the browser's history.
Jeremy
>Hello everybody,
>
>I've read a lot about disabling the browser back
>button when a user submits a form where the action
>page is different from the submitting page.
>
>It is absolutely important that the user is stopped
>from going back a page because This is an application
>where authorised users can add new users
>
>Ok, here it goes. The super user fills in the new user
>form and submits the page. On form submission I'm
>displaying a confimation message. This is displayed
>inside a div tag.
>
>Here, this might help.
>
><cfif isDefined("form.hid_adduser") and
>form.hid_adduser neq "">
> <!--- code to add the user in the database starts
>here --->
>
> <!--- code to add the user in the database ends here
>--->
>
> <CFLOCATION URL=""> >addtoken="no">
></cfif>
>
><cfif isDefined("url.callAdded")>
><body>
><div id="confirmdiv" style="z-index:2;
>position:absolute; left:35px; top:90px; width:650px;
>display:block">
><cfoutput>
><table border="0" align="center" width="355"
>height="205">
> <tr>
> <td valign="bottom">
> <div style="position:relative; left:15px; top:1px;"
>class="label">
> Thank you for adding a new user. An email has been
>sent to the customer to advise.
> </div>
> </td>
> </tr>
></table>
></cfoutput>
></div>
></body>
><cfelse>
><body>
><form name="addUserFrm" method="post" action=""> ><cfoutput><input type="hidden" name="returnto"
>value="#cgi.script_name#?#cgi.query_string#"></cfoutput>
><table border="0" cellpadding="0px" cellspacing="3px">
> <tr>
> <td><input name="newuser" type="text"></td>
> </tr>
> <tr>
> <td><input type="submit" name="addUser" value="Add
>User"></td>
> </tr>
></table>
><input type="hidden" name="hid_adduser" value="">
></form>
></body>
></cfif>
>
>I want to disable the 'back' button when the user sees
>the confimation message. Is this possible, if yes can
>somebody please show me.
>
>Best regards,
>cfcoder
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Win a $20,000 Career Makeover at Yahoo! HotJobs
>http://hotjobs.sweepstakes.yahoo.com/careermakeover
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

