CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 That annoying browser back button....

Print topic Send  topic

Author Message
mljonzs

Posts: 124
Posted: 06/07/2007, 10:47 AM

I sure hope someone can help me.....

I have a CCS application that was thrown together in a hurry and now we are having problems with it. 99% of the time all is good so long as the users don't use the back button. But occasionally a user will click the back button which returns them to the previous page before the record was submitted. They proceed to modify the record and then submit in the hopes of creating a new record. To make a long story short this is the cause of the problem. Once a new record is inserted, there is code in the After Execute Insert event to send an email based on the data on the form, not out of the database. When the user goes back and tries to create a new record in this manner, a Primary Key constraint error prevents the write into the database but it doesn't stop the email code from firing and providing incorrect data - the user gets the email and assumes they created a new record.


So, here's the problem - I can't totally prevent this page from displaying when the user clicks the back button to get there - does anyone know how to prevent the page display and/or to simply refresh the page when the back button goes there? A refresh of the page would prevent editing and submitting.

Secondly, why does the After Execute Insert code execute even though the insert never happened?

Thanks!
mlj


Update - okay, I'm burnt out! I did get the email to not send if there are any errors on the insert - I did the following in the After Execute Insert event:

If DBConnection.Errors.Count = 0 then  
      Call SendEmail(r)  
End If  


I'm still looking to find out how to either expire the page so the back button won't display it or to magically refresh/reload the page if the back button is used to get to it......
_________________
What does not begin WITH God, will end in failure!
View profile  Send private message
kevind

Posts: 251
Posted: 06/14/2007, 6:04 PM

I haven't had time to read through this. But here's one page I was researching on .... it's .NET, but may have ASP applications.

http://aspalliance.com/694_Preventing_Page_Review_after...ntication#Page1

good luck
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
ttflyer

Posts: 11
Posted: 06/18/2007, 2:37 PM

Hello-
I run into this all the time in intranet apps.
In general terms I do the following:
1)As the user moves 'forward' through the data entry process, I set and increment a Session variable as each new page is loaded.
2) each page checks the session variable value and decides what to do based on the number.
3)You can redirect (refresh) based on the value if needed.
4) I always try to use the meta tags for no-cache and expire -1 to help prevent browser caching

We also often use this type of session value setting to provide a feedback page. all pages point to the same page but we change the label values and redirect values based on where the request came from using the session.
~Andy
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.