public class BeanValidator extends 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 java.lang.Object[] |
getValidationInfo(ValidationContext ctx,
java.lang.Object base,
java.lang.String property)
Get the bean class of the base object and property to validate.
|
getValidator, handleConstraintViolation, sort, validate, validateaddInvalidMessage, addInvalidMessage, addInvalidMessages, addInvalidMessagesprotected java.lang.Object[] getValidationInfo(ValidationContext ctx, java.lang.Object base, java.lang.String property)
getValidationInfo in class BeanValidatorctx - the validation contextbase - the base objectproperty - the property to validateCopyright © 2005-2011 Potix Corporation. All Rights Reserved.