I have requirements to code something that I need some help with.  I
am encountering the following issue:  I need to display a window right
before someone leaves the page they are on.  Basically prompt them to
save their changes or continue on to the next page.  On the save I
execute an AJAX request to Save and then they go on to the next page.
Well I can do this easily using the regular javascript confirm object:
<body onunload="var x=confirm("save changes");if(x) ajxcalltosave();">

However I need to do this using the prototype window.  As I need to
override the button choices to be "yes, save" or "no, don't". (which
to my knowledge you cannot do with confirm)
During the unload event-- When I instantiate a Dialog.confirm window
via prototype's libraries the window shows up for a split second and
the user gets redirected to the next page.  I want to make the
prototype window stay before moving on to the next page.  That is the
issue.  I have used it before and can display the window and it
behaves properly on every other event other than unload, and I don't
understand why. I'm sure if I step through the code enough times I
should hopefully find some clue as to its behavior. But haven't found
any so far.

I could open another window referring to a different page with the
question and buttons, in which case the parent page would already move
on and I'd have to pass all the information to execute the save as
parameters to the request displayed in the new window.  That would be
kind of cloojy.

If there is some way I could abort the unload or redirect back to the
same page then show the Dialog.confirm window that would work but I
would need to know where the user initially intended on leaving to so
that I could redirect them there after the save.

RECAP
Option 1:  Override confirm's button choices.   CON:  Not possible as
per my knowledge
Option 2: Make the prototype window not disappear before moving on to
the next page.  CON: I don't know how
Option 3: Open another window CON: Not pretty, the parent page moves
on before the save occurs, would not appease requirements
Option 4: Abort the unload, stay on the same page  CON: Need to know
where the user meant to go so they could be redirected back there
later

Thank you for reading this.  If you can provide some insight to my
issue, I'd really appreciate it.  (I really would like to be able to
execute option 2.)

:-)
radha

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to