0

About setMoldSClass

asked 2008-09-25 16:16:29 +0800

esdlbt gravatar image esdlbt
30

Hi, I'm using the new setMoldSclass function over a custom Textbox to override the look and field.
As an example I set my css as:
.myinput{border-color:#FF00A0;border-style:solid;border-width:1px;color:#00FF00;padding-left:5px;}
.myinput-text-invalid{border-color:#00ff00;border-style:solid;border-width:medium;font-family:'arial black';padding-left:3px;}

and set my textbox with
<textbox moldsclass="myinput" />

But what can I do if I have a noempty constraint in my textbox and I want to look different maybe with a:
.myinput-text-noempty{border-color:#00ff00;}

How can I implement this?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2008-09-26 01:14:34 +0800

flyworld gravatar image flyworld
155 3

updated 2008-09-26 01:15:56 +0800

here is a example use custom constraint

<window title="Textbox with constraints">
  <style>
	.myinput{border-color:#FF00A0;border-style:solid;border-width:1px;color:#00FF00;padding-left:5px;}
	.myinput-text-invalid{border-color:#00ff00;border-style:solid;border-width:medium;font-family:'arialblack';padding-left:3px;}
	.myinputempty-text-invalid{border-color:#00ff00;} 
  </style>
  <vbox>
  <zscript><![CDATA[  
        class MyConstraint extends SimpleConstraint implements CustomConstraint {
	  public MyConstraint() {
		super(NO_EMPTY);
	  }
	  public void showCustomError(Component comp, WrongValueException ex) {
		comp.getFellow("tb").setMoldSclass("myinputempty");
	  }
        }
        MyConstraint ms = new MyConstraint();
  ]]></zscript>
  <textbox id ="tb" moldSclass="myinput" constraint="${ms}" />	
  </vbox>		
</window>

see more .. take a look of this javadoc
http://www.zkoss.org/javadoc/3.0.0/zul/org/zkoss/zul/SimpleConstraint.html

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: 2008-09-25 16:16:29 +0800

Seen: 166 times

Last updated: Sep 26 '08

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