-
FEATURED COMPONENTS
First time here? Check out the FAQ!
![]() | 1 | initial version | |
I tried to implement a validator in my test form. I read some examples obviously I did not understand...
My .zul form
<groupbox form="@id('gbD') @load(vm.selected) @save(vm.selected, before='saveOrder')"
id="formGroup" visible="@load(not empty vm.selected)" hflex="true" mold="3d"
validationMessages="@id('vmsgs')">
<grid hflex="true" >
<columns>
<row>
Cognome/Nome
<hbox>
<textbox value="@bind(gbD.cognome)" maxlength="50" width="250px" />
<textbox value="@bind(gbD.nome) @validator('vm.Validator1')"
maxlength="50" width="250px" />
<label value="@load(vmsgs['ctxnome'])" sclass="red"/>
</hbox>
</row>
The textbox field nome has a validator....
public class aaa extends SelectorComposer<Window>
{
private static final long serialVersionUID = 1L;
private List<Utenti> lstUtenti;
private Utenti selected;
....
public Validator getValidator1()
{
return new AbstractValidator()
{
public void validate(ValidationContext ctx)
{
String nome = ctx.getProperties("nome")[0].getValue().toString();
if(nome.equalsIgnoreCase("pirla"))
{
addInvalidMessage(ctx,"ctxnome","non insultare!!!");
}
}
};
}
When occurs onChange on field I have an class error...
Thanks. Luca
![]() | 2 | retagged |
I tried to implement a validator in my test form. I read some examples obviously I did not understand...
My .zul form
<groupbox form="@id('gbD') @load(vm.selected) @save(vm.selected, before='saveOrder')"
id="formGroup" visible="@load(not empty vm.selected)" hflex="true" mold="3d"
validationMessages="@id('vmsgs')">
<grid hflex="true" >
<columns>
<row>
Cognome/Nome
<hbox>
<textbox value="@bind(gbD.cognome)" maxlength="50" width="250px" />
<textbox value="@bind(gbD.nome) @validator('vm.Validator1')"
maxlength="50" width="250px" />
<label value="@load(vmsgs['ctxnome'])" sclass="red"/>
</hbox>
</row>
The textbox field nome has a validator....
public class aaa extends SelectorComposer<Window>
{
private static final long serialVersionUID = 1L;
private List<Utenti> lstUtenti;
private Utenti selected;
....
public Validator getValidator1()
{
return new AbstractValidator()
{
public void validate(ValidationContext ctx)
{
String nome = ctx.getProperties("nome")[0].getValue().toString();
if(nome.equalsIgnoreCase("pirla"))
{
addInvalidMessage(ctx,"ctxnome","non insultare!!!");
}
}
};
}
When occurs onChange on field I have an class error...
Thanks. Luca