public interface ClientConstraint
Constraint
to handle
the validation at the client.
Note: this interface is ignored if CustomConstraint
is also implemented, since CustomConstraint
causes
all validations are processed at the server.
Constraint
,
CustomConstraint
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getClientConstraint()
Returns the JavaScript snippet that will be evaluated at client
to return a validator, or null if no client constraint is supported.
|
java.lang.String |
getClientPackages()
Returns a list of packages separated by comma that ZK client
engine has to load before evaluating
getClientConstraint() . |
java.lang.String getClientConstraint()
For example,
String getClientConstraint() {
return "new foo.MyValidator()";
}
Instead of return the snippet of JavaScript codes, it can return an instance of JavaScript string (enclosed with quotation), if the validator is zul.inp.SimpleConstraint.
For example,
String getClientConstraint() {
return "'no empty'";
}
The validator could implement the validate
,
and showCustomError
methods, and an optional property,
serverValidate
methods as follow. validate
is required,
while showCustomError
and serverValidate
are optional.
String validate(Widget wgt, String value);
Object showCustomError(Widget wgt, String errmsg);
boolean serverValidate;
Please refer to zul.inp.SimpleConstraint for details.
Notice that CustomConstraint
has the higher priority than
ClientConstraint
. In other words, ClientConstraint
is ignored if both defined.
java.lang.String getClientPackages()
getClientConstraint()
.
For example,
com.foo,com.foo.more
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.