forms
forms copied to clipboard
Implement warning when leaving an unsubmitted form
@jotoeri any ideas why the custom message isn't shown in the window.confirm() dialog?
Seems like just confirm should work. But to be honest, i currently can't tell you exactly, why. :laughing:
https://github.com/nextcloud/forms/blob/6c257edeea2231aeb55f1b62ab85dbb49d6ecef7/src/components/AppNavigationForm.vue#L207
@jotoeri Tried it with just confirm() but doesn't work either... Even with static text. Did just research and it seems that it doesn't accept custom text for the onbeforeunload event
Ok, sorry @Chartman123 i checked it once before quickly, but i definitely have not time to get into detail currently. Needs probably to be postponed.
No problem, I think the design parts are more important for 3.0 than this here :)
confirm and alert are not allowed within beforeunload.
Also all browser dropped support for custom messages, so you only can use the default one.
Chrome removed support for custom message in ver 51
Opera removed support for custom message in ver 38
Firefox removed support for custom message in ver 44.0
Safari removed support for custom message in ver 9.1
Yes, that's true. I'm currently trying to move the warning to a NcModal like in the Cookbook app... This should at least work for leaving a form without closing the window/tab.
@susnux Thanks for your input :) I'm also planning to move the warning to a modal. If you want, you can help me there. Everytime I tried it ended up being even worse 😆
@susnux I think I got this working as expected right now. I think we should merge this without the modal, so that we can take it as a basis for @hamza221's PR regarding the local storage.