G
Guest
When a client requests to leave a Web Page, I want the web page to check for a certain condition. If that condition is met, I want to prompt the user to make sure they want to leave
The method I am currently using is
<HTML><HEAD
..
<script><!-
function PageBeforeUnloadCheck(
..
if (...)AdministratorStatusReportSummaryForm.TheReportTypes.value ==
event.returnValue = "The Summary has not been saved!"
--></script></HEAD><body onbeforeunload="PageBeforeUnloadCheck()"
..
</body></HTML
My problem is that the java function PageBeforeUnloadCheck is executed for every PostBack, not just when the page is going to change or the browser closed. After some thought, this makes sense because the client site does not know what the response will be, it might be a new page address. My problem is that I cannot figure out how the java script can know what action the client took. Was it a button press, the change in selection of a dropdownlist, or ...
What variable/parameter/attribute can the script use to determine the user action?
The method I am currently using is
<HTML><HEAD
..
<script><!-
function PageBeforeUnloadCheck(
..
if (...)AdministratorStatusReportSummaryForm.TheReportTypes.value ==
event.returnValue = "The Summary has not been saved!"
--></script></HEAD><body onbeforeunload="PageBeforeUnloadCheck()"
..
</body></HTML
My problem is that the java function PageBeforeUnloadCheck is executed for every PostBack, not just when the page is going to change or the browser closed. After some thought, this makes sense because the client site does not know what the response will be, it might be a new page address. My problem is that I cannot figure out how the java script can know what action the client took. Was it a button press, the change in selection of a dropdownlist, or ...
What variable/parameter/attribute can the script use to determine the user action?