Keyword

Frontend Editing: Warn before Close Modal/Window

  • SPOTTERON
  • SPOTTERON's Avatar Topic Author
  • Offline
  • New Member
More
2 weeks 15 hours ago #178541 by SPOTTERON
I try to add a warning in the frontend-editing mode when a user clicks "close" or in modal view, clicks in the space outside the modal box - but yet no success.
The warning should simply display: "Do you have any unsaved changes? Please is save first before closing the submission form!" - ideally with 2 buttons: Go back | Close window.

Is there a way to achieve that? Without warning, especially in modal mode, the submission form has a big usability issue. A user can enter information, extra fields, etc and then simply misclick in the outside area > all input are done. A coniframtion/question would solve this problem.
thanks very much for the support or advice :)
best regards, Jonathan

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar
  • Away
  • Premium Member
More
1 week 6 days ago #178543 by Goble002
Hi,

Am getting another behavior here. Message hereunder when I click the close button in Modal view. However clicking outside modal window will not actually try to close modal.

P.S this applies if content is changed (for intro / full text editor). Changes in Title / Alias will not trigger messages. I haven't tried other fields. Message is from browser though.

Firefox:
"Are you sure ? This page is asking you to confirm that you want to leave — information you’ve entered may not be saved."
Option: Reload / Cancel

Chrome:
"Reload site ? Changes you made may not be saved."
Option: Leave / Cancel

However whatever option you click your changes will not be unsaved.

P.S Running default Joomla 3.9.25 with Beez and only k2 2.10.3 loaded only

Please Log in or Create an account to join the conversation.

  • SPOTTERON
  • SPOTTERON's Avatar Topic Author
  • Offline
  • New Member
More
1 week 6 days ago - 1 week 6 days ago #178548 by SPOTTERON
Replied by SPOTTERON on topic Frontend Editing: Warn before Close Modal/Window
Hi, you mean a warning message is already present? That's weird - I just have downloaded the current K2 version and copy-pasted over the contents of administrator\components\com_k2\views\item\tmpl\default.php to the according folder in HTML template override as it is suggested. The itemform is defiantly replaced by this action as it changes back to the default layout, but still - there are no warning messages on the close button and if I click the dark space around the modal, the form is closed immediately.

There are also zero errors in the developer console.

What could be an issue here?
Best regards
Jonathan
Last edit: 1 week 6 days ago by SPOTTERON.

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar
  • Away
  • Premium Member
More
1 week 6 days ago #178553 by Goble002
Yes for me it is but like I said, it's with default joomla installation running Beez. No third-party (other than k2) plugins loaded.

The messages are from the browser. For example if you try to save an item without selecting category. You will get a message about that.

Edit from my previous post: "However whatever option you click your changes will not be unsaved."

I guess @Fotis may enlighten us here about that.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 6 days ago #178567 by Fotis
@SPOTTERON There is no current protection for that, sorry. And there is no point in fixing that now as it will be changed overall within the coming month to a different (more usable) solution. What you could do in the meantime is "inspect" the <a> element that surrounds the modal window and either displace it using CSS or inject some JS to change its behaviour (=stop the link from working with e.preventDefault() for example...).

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum