Message Box

From Documentation
Documentationessage Box
essage Box

Stop.png This documentation is for an older version of ZK. For the latest documentation please click here.

The Message Box

The org.zkoss.zul.Messagebox class provides a set of utilities to show message boxes. It is typically used to alert user when an error occurs, or to prompt user for an decision.

if ("Remove this file?", "Remove?", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) ==  Messagebox.YES) {
 ...//remove the file

Since it is common to alert user for an error, a global function called alert is added for zscript. The alert function is a shortcut of the show method in the Messagebox class. In other words, The following two statements are equivalent.


Notice that Messagebox is a modal window so it shares the same constraint: executable only in an event listener. Thus, the following codes will fail. Refer to the Modal Windows and Event Listeners section above for more descriptions.

<window title="Messagebox not allowed in paging loading">
		//failed since show cannot be called in paging loading
		if ("Redirect?", "Redirect?",
		Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES)

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.