Hi,

In panel form my inputText reference a validation method with "validator" attribute. If validation failed my method throw a javax.faces.validator.ValidatorException.

my code:
/public void validate(FacesContext pContext, UIComponent pToValidate, Object pValue)
   {
       if(mMaxLength>0)
       {
           if(pValue.toString().length()>mMaxLength)
           {
FacesMessage errMsg = JSFService.getFacesMessage(pContext,JSFService.MESSAGE_ID_VALIDATOR_LENGTH,new Object[]{Integer.toString(mMaxLength)});
               throw new ValidatorException(errMsg);
           }
       }
   }/

In my page when form is redisplayed error message is not displayed in the inputText not validated but is displayed in <af:messages/>

In my backing bean if I throw exception in the setter, the error message is displayed automatically in the right inputText

How can I do that with validator ? (for some reasons, validation must be done in external method, not in the setter).

In the docs /input components typically support automatically showing their own messages, including a tip and the error message/.

thanks
Arnaud

Reply via email to