public class BeanValidator
extends org.zkoss.bind.validator.BeanValidator
AbstractValidator.addInvalidMessage(ValidationContext, String).
To use this class, you have to add @validator('beanValidator') or @validator('org.zkoss.zkmax.bind.BeanValidator') to the property-binding
Example
<grid width="600px">
<textbox id="tb" value="@bind(vm.person.firstName) @validator('beanValidator')"/>
<label value="@load(vmsgs[tb])"/>
</grid>
It also supports to validate a property of a form which properties are load from a bean,
It uses the class of last loaded bean of the form to perform the validation, which means it doesn't support to validate a form that didn't loaded a bean yet.
Example
<grid width="600px" form="@id('fx') @load(vm.user) @save(vm.user,after='save')">
<textbox id="tb" value="@bind(fx.firstName) @validator('beanValidator')"/>
<label value="@load(vmsgs[tb])"/>
</grid>
| Constructor and Description |
|---|
BeanValidator() |
| Modifier and Type | Method and Description |
|---|---|
protected Object[] |
getValidationInfo(org.zkoss.bind.ValidationContext ctx,
Object base,
String property)
Get the bean class of the base object and property to validate.
|
getValidator, handleConstraintViolation, sort, validate, validateprotected Object[] getValidationInfo(org.zkoss.bind.ValidationContext ctx, Object base, String property)
getValidationInfo in class org.zkoss.bind.validator.BeanValidatorctx - the validation contextbase - the base objectproperty - the property to validateCopyright © 2026. All rights reserved.