In which event i can force user to save its data
-
Hello I have a web page with different parts. In some parts of it, user can change the data of that. I put a button to save the data of each part, separately. The user can enter new data without saving them. But I want to show a message to save them. The message should be shown when user closes the window or click some links. This message should be shown client side. I know the command window.alert(...). I do not know in which JavaScript event I should show that to support every option of page transfer. Please instruct me or offer me a different way. Thanks Rastgar
-
Hello I have a web page with different parts. In some parts of it, user can change the data of that. I put a button to save the data of each part, separately. The user can enter new data without saving them. But I want to show a message to save them. The message should be shown when user closes the window or click some links. This message should be shown client side. I know the command window.alert(...). I do not know in which JavaScript event I should show that to support every option of page transfer. Please instruct me or offer me a different way. Thanks Rastgar
either or function functionName() { alert('pls save'); window.event.returnValue = false; window.event.cancelBubble=true; }
-
either or function functionName() { alert('pls save'); window.event.returnValue = false; window.event.cancelBubble=true; }
Thanks for your help. Your code works very well. But when i use it, after alert 'pls save', I have another alert: "Are you sure you want to navigate away from this page? false Press ok to continue, or cancel to stay on the current page." it happens after code: "window.event.returnValue = false;" I don't want this alert to be shown. What should I do? Thanks Rastgar
-
Thanks for your help. Your code works very well. But when i use it, after alert 'pls save', I have another alert: "Are you sure you want to navigate away from this page? false Press ok to continue, or cancel to stay on the current page." it happens after code: "window.event.returnValue = false;" I don't want this alert to be shown. What should I do? Thanks Rastgar
Not possible to stop browser to close in JS. So u have to go with that extra alert.