Connecting Tech Pros Worldwide Forums | Help | Site Map

window.onbeforeunload and postback

rufus
Guest
 
Posts: n/a
#1: Jul 21 '05
I have a function that checks whether the user is trying to navigate away
from the page before saving all their data. I achieve this using the
window.onbeforeunload javascript event. It fires when somone clicks on a
link or button but not when someone changes the selected index of a
dropdownlist or radio button.

I tried registering the following script:
RegisterOnSubmitStatement("submit", "confirmClose;") but it does not fire
when a dropdownlist or radio button list postsback. Any ideas on how to do
this?

Thanks

rufus
Guest
 
Posts: n/a
#2: Jul 21 '05

re: window.onbeforeunload and postback


I just read the onbeforeunload reference at:
http://www.msdn.microsoft.com/librar...foreunload.asp
and it states that the event can be invoked using the form submit method. I
checked the '__doPostBack' script and it contains the line
'theform.submit()'.

So I guess it should work...but it doesn't. Any ideas?

"rufus" wrote:
[color=blue]
> I have a function that checks whether the user is trying to navigate away
> from the page before saving all their data. I achieve this using the
> window.onbeforeunload javascript event. It fires when somone clicks on a
> link or button but not when someone changes the selected index of a
> dropdownlist or radio button.
>
> I tried registering the following script:
> RegisterOnSubmitStatement("submit", "confirmClose;") but it does not fire
> when a dropdownlist or radio button list postsback. Any ideas on how to do
> this?
>
> Thanks[/color]
Closed Thread