-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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?
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>
Asked: 2008-09-25 16:16:29 +0800
Seen: 166 times
Last updated: Sep 26 '08