This one has been very useful. We tend to set the message when we’re in an edit state (or not saved). It at least keeps users from accidentally leaving the site or quitting the browser.
I also put the following code in the app.HTMLHeader section… which keeps the ‘Backspace’ key from causing the browser to go ‘Back’ should the user accidentally not have the cursor in a textfield/textarea at the time. This helps…
Eric, I don’t see any “HTMLHeader” property in the App class? Am I being stooopid? Or do you use the Session.PrepareSession event to insert your script into the HTMLHeader?
No. Remember, you can’t directly respond to things happening on the browser because by the time the message gets to the server, the browser has gone on to other things. This is one of those events where you must return a value in the same JavaScript event as it was triggered and since you can’t do that with a round trip to the server, it must be done with a pre-stored Boolean.
@Greg O’Lone
You are right ! I often forget this problem since I regularly look for workarounds by Javascript.
That said, a solution must be found to prevent the user from accidentally leaving the application. The “ConfirmMessage” is not appropriate.
What is possible in the state?
[quote=19660:@Eric Brown]I also put the following code in the app.HTMLHeader section… which keeps the ‘Backspace’ key from causing the browser to go ‘Back’ should the user accidentally not have the cursor in a textfield/textarea at the time. This helps…
No. You can’t put a body tag in the header. Any “merging” you are seeing is being done by the browsers themselves. And the behavior will likely be different on different browsers.