Last post Jun 04, 2019 08:02 PM by KathyW
Jun 03, 2019 10:43 AM|shsu|LINK
How can I prevent the user,to close the webpage using default x.
or else a warning message if ok can close ,if no the can not close.
Appreciate the help
Jun 03, 2019 11:15 AM|PatriceSc|LINK
Your final goal being ? You can use https://www.w3schools.com/jsref/event_onbeforeunload.asp for example to show a message if trying to close a window with pending change. The general
idea is to keep users in control (for example window.open does allow some control - I saw once someone using that for a login form - but IMO you could lose non captive users pissed-of by imposing too much on them...
Jun 04, 2019 02:58 AM|shsu|LINK
I have an Report. when users upload multiple attachments to the detail table .,During that time ,I am generating the ID in the header table.
Now the issue happening is : User will open the webpage and upload attachments, then they just close the window x. My code for saving the status of ID is in submit or draft button. Instead of clicking these buttons,they close. then ID with attachments are
there in DB WITH OUT STATUS. To avoid that,if I could show a message to force them to draft or submit.it I will be best.
Thanks it worked. But If I don't want "Leave this Page" because I only need stay on this page.
Jun 04, 2019 07:39 AM|PatriceSc|LINK
It could be abused by malicious sites so you can warn the user but he can still decide what to do next (this is a general approach ie you can ask to enter full screen mode or to download a file etc... but the user can always accept or decline this).
Depending on your design the upload could be done on the main page for example a webmail site will allow to upload attached files and write the message on the same window. so that a user can upload files and keep writing his message...
Jun 04, 2019 08:02 PM|KathyW|LINK
You can't prevent someone from closing their browser, and if you try, you will anger visitors to your site. But you can give them clear instructions about what they are doing, how to do it, and the consequences of doing it incorrectly, including telling
them that they are not done until clicking the submit or draft button.
Or, you could change your design and have more than one file upload button, one for draft and one for submit, and capture the status for the attachments at the same time you are doing the upload.