Interface ClientConstraint
-
- All Known Implementing Classes:
AbstractSimpleDateTimeConstraint
,SimpleConstraint
,SimpleDateConstraint
,SimpleDoubleSpinnerConstraint
,SimpleLocalDateConstraint
,SimpleLocalTimeConstraint
,SimpleSpinnerConstraint
public interface ClientConstraint
Addition interface implemented withConstraint
to handle the validation at the client.Note: this interface is ignored if
CustomConstraint
is also implemented, sinceCustomConstraint
causes all validations are processed at the server.- Author:
- tomyeh
- See Also:
Constraint
,CustomConstraint
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 evaluatinggetClientConstraint()
.
-
-
-
Method Detail
-
getClientConstraint
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. The validator is later used to validate an input.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
, andshowCustomError
methods, and an optional property,serverValidate
methods as follow.validate
is required, whileshowCustomError
andserverValidate
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 thanClientConstraint
. In other words,ClientConstraint
is ignored if both defined.- Returns:
- the code snippet that will be evaluated at client to return a validator.
- Since:
- 5.0.0
-
getClientPackages
java.lang.String getClientPackages()
Returns a list of packages separated by comma that ZK client engine has to load before evaluatinggetClientConstraint()
.For example,
com.foo,com.foo.more
- Since:
- 5.0.0
-
-