1 Reply Latest reply on Mar 16, 2006 12:37 AM by gavin.king

    Different validator messages

    trippccn

      I have a Member.java pojo that maps to a database table which describes a user of our site. I use @In during the RegisterAction to enter the user into the database, and then @In again for the LoginAction to check the email/pass and log them in.

      Problem is, I use a validator in the Member.java:

      @Length(min=4, message="Password must be 4 or more characters.")


      That validator makes sense during registration but not during login. During login it should just say "please enter a password".

      Am I going about this the wrong way? Is there an easy way to solve the problem?

      Thanks,
      Chad

        • 1. Re: Different validator messages
          gavin.king

          I would probably not use @IfInvalid for login. Instead, validate the password in the action method and add a FacesMessage in code, or just do it in the JSF form with a JSF validator.

          This is not a "model" validation.