471,857 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,857 software developers and data experts.

Differentiate between a page unload and a page refresh.

Hi Guys,

Have been looking at this for a while and not sure if there is a solution but hopefully someone can point me in the right direction:

The problem is essential I want to undo an update if the user unloads a page but not if they just refresh the page.

I have 2 asp pages.
Page 1 solicits some information and updates the database. This information is then posted to Page 2, where further details are entered and a final update is done. If however the user does not confirm the update on Page 2 and unloads the page I undo all updates by calling a function in the OnUnLoad event. This works fine but the problem is this function is also called if the user just does a Refresh on page 2.

In Summary:
Page 1, enter information,
Submit and Update the Database
Post details to Page 2
Enter more information on Page 2 and complete the update.
If Page 2 is unloaded OnUnLoad function is called and all updates are cancelled.
Problem: If Page 2 is refreshed, the the OnUnLoad event is also called and updates are also cancelled.

Any help would be appreciated.

Jul 26 '07 #1
1 2287
692 Expert 512MB

Is there any specific need for updating partial information on page1? Instead, you can pass all the information from page1 to page2 using Hidden fields or some other way and then make a final update on Page2 only. So this will not affect page_unload or refresh.
Aug 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Matt | last post: by
4 posts views Thread by Stephajn Craig | last post: by
1 post views Thread by mgonzales3 | last post: by
1 post views Thread by Donkey Cart Racer | last post: by
1 post views Thread by Areric | last post: by
5 posts views Thread by =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.