existing web document without saving

How do I prevent a user from existing the web enabled form without clicking the save button. Currently they can use the backward or forward buttons on the browser to exit without saving or click on any links.
Who is Participating?
sam_claytonConnect With a Mentor Commented:
Close but not exactly what you want might be:
1) open the document in a browser window which has no back/forward/home buttons.
2) Use the VERY annoying technique of re-opening the page if they try and close it. (trap the onunload event in Javascript)

remember a web session is stateless and this sort of thing is dificult to implement in that arena.

Hope it helps,

You can use @Command([Fileclosewindow]) to close the document without saving, this action will take him to previous screen from where he started.

Good Luck
pcorreyaAuthor Commented:
I need to prevent them doing this, not letting them exit.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I really doubt that this it is possible to do what you ask but if you want people to at least read your question just in case there is a way, you need to reject HemanthaKumar's answer so that your question is no longer locked.

It is impossible to stop someone pressing the back button on there browser or closing your window... It is possible to stop them saving the document without filling in all of the required data using either server side field validation or client side javascript validation , but it is not possible to trap a user at  page ..

 If it was how long do you think the internet would have lasted !!!
pcorreyaAuthor Commented:
This is for an intranet application and we need users to save the data before they go off and do something else.
There is a way to disable the back button of the browser, you should ask this in the Internet forum (or Javascript forum).
With Notes, you can only make sure that before going on the document is saved.
However there is no way to stop users from closing their browser. The only thing you can do is have it automatically save when the user leaves the page if it has not been saved yet.

How can, at least, alert the user that the information he typed would not be saved?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.