pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luiz Gustavo <luizgustav...@gmail.com>
Subject Problems with flags
Date Wed, 22 Dec 2010 02:37:51 GMT
Hi,

I'm having problems using Form.flag.


I have a method for inserting data from a form, and a validation on the
begining:


private void salvarEdicao() {

    try {

     Form.Flag flagDesc = null;
      Form.Flag flagVal = null;
      Form.Flag flagCat = null;

      String desc = descricao.getText();
      String val = valor.getText();

      if(desc == null || "".equals(desc.trim())){
        flagDesc = new Form.Flag(MessageType.ERROR,
resources.get("campoRequerido").toString());
      }
      Form.setFlag(descricao, flagDesc);

      if(val == null || "".equals(val.trim())){
        flagVal = new Form.Flag(MessageType.ERROR,
resources.get("campoRequerido").toString());
      }
      Form.setFlag(valor, flagVal);

      if(categoria == null){
        flagCat = new Form.Flag(MessageType.ERROR,
resources.get("campoRequerido").toString());
      }
      Form.setFlag(categoria, flagCat);

      if(flagDesc != null || flagVal != null || flagCat != null){
        return;
      }

      ...
}


When I try to submit a form with desc and val (description and value) empty,
just one flag is presented. Even when I insert data in the "Descrição"
field, the flag in the field "Descrição" continues to apear. The flag of
field "Valor" doesn't apear in neigther cases.


Any idea?

Cheers,
Luiz Gustavo S. de Souza

http://luizgustavoss.wordpress.com
http://luizgustavoss.blogspot.com
http://twitter.com/lugustso

Mime
View raw message