Warn user before leaving web page with unsaved changes

asked 2022-07-19 21:14:54 +0800

mpanagiotou gravatar image mpanagiotou

Hi, I am new to the ZK environment. In my application I have a .zul page with text inputs and drop-downs. Is there a way to warn the user before leaving the page that there are unsaved changes?

Thanks in advance!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-07-20 15:50:25 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2022-07-20 16:27:52 +0800

You can call

Clients.confirmClose("any"); //with non-null string

To enable page leaving warning message. Then when you leave the current page (close, reload, visit a link), the browser will show its default warning dialog.


link publish delete flag offensive edit


Thank you for your answer! Is there a way to detect if there are unsaved changes in the page? Or do I have to implement it manually?

mpanagiotou ( 2022-07-20 16:30:11 +0800 )edit

zk cannot tell what is "unsaved". It's an application logic that you have to implement by yourself.

hawk ( 2022-07-22 15:31:55 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2022-07-19 21:14:54 +0800

Seen: 6 times

Last updated: Jul 20 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More