0

Customizing Error Box

asked 2010-05-15 12:32:12 +0800

dorr gravatar image dorr
126 4

Is there a way to customize the error box such as left-alignment and nowrap? I'm displaying multiple errors for a field and want the errors left aligned instead of centered.

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2010-05-15 17:51:51 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-05-15 17:52:45 +0800

You can start to play with the following (More you can read in the Developer Reference):

zk.xml

	<!-- ====================================================== -->
	<!--                Path to the own error page              -->
	<!-- ====================================================== -->
	<error-page>
		<exception-type>java.lang.Throwable
		</exception-type>
		<location>/error.zul</location>
	</error-page>

.


error.zu
l

<?xml version="1.0" encoding="UTF-8" ?>
<zk xmlns="http://www.zkoss.org/2005/zul"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
	<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>

	<window
		title="Error ${requestScope['javax.servlet.error.status_code']}"
		width="450px" border="normal" mode="modal">
		<vbox>
			<separator />
			<separator />

			<div sclass="z-messagebox" width="100%">
				<label multiline="true"
					value="${requestScope['javax.servlet.error.message']}"
					sclass="word-wrap" width="100%" />
			</div>

			<separator />
			<hbox style="margin-left:auto; margin-right:auto">
				<button label="Continue" onClick="spaceOwner.detach()" />
				<button label="Reload"
					onClick="Executions.sendRedirect(null)" />
			</hbox>
		</vbox>

		<!-- optional: record the error for improving the app -->
		<zscript>
	org.zkoss.util.logging.Log.lookup("Fatal").error(
			requestScope.get("javax.servlet.error.exception"));
</zscript>
	</window>

</zk>

best
Stephan

link publish delete flag offensive edit

answered 2010-05-17 00:59:32 +0800

dorr gravatar image dorr
126 4

Thanks Tornado, I'll give that a shot.

link publish delete flag offensive edit

answered 2010-05-17 19:13:59 +0800

dorr gravatar image dorr
126 4

I'm not sure if we're talking about the same error box. I'm talking about the error box that pops up when a constraint fails. Sounds like you are talking about an error page?

link publish delete flag offensive edit

answered 2010-05-18 01:38:52 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Hi dorr,

You have to override the showError_() method from InputWidget and then implement your own Errorbox object.
For example,

<zk xmlns:w="http://www.zkoss.org/2005/zk/client">
<textbox constraint="no empty" w:showError_="function(mesg){zk.error(mesg);}"/>
</zk>

link publish delete flag offensive edit

answered 2010-05-18 03:34:47 +0800

PeterKuo gravatar image PeterKuo
481 2

@dorr,
for more information about customization, please refer to
http://docs.zkoss.org/wiki/Client_Side_Programming

link publish delete flag offensive edit

answered 2010-11-09 05:07:42 +0800

fumoseaffabulazioni gravatar image fumoseaffabulazioni
42

Is there any document about error box CSS?
I took a look in the official style guide, but I didn't find anything.

Thanks,
Dario

link publish delete flag offensive edit

answered 2010-11-15 19:12:32 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

you can utilize the firebug plugin to inspect its CSS rule.

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2010-05-15 12:32:12 +0800

Seen: 1,088 times

Last updated: Nov 15 '10

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