Revision history [back]

click to hide/show revision 1
initial version

asked 2013-02-07 18:23:55 +0800

lramellavotta gravatar image lramellavotta flag of Italy

MVVM Validator: class not found ?

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

MVVM Validator: class not found ?

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

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More