1 Reply Latest reply on Sep 10, 2008 7:00 PM by Nick Belaevski

    BeanValidator and validator method doens't work

    demetrio812 Apprentice

      I have an inputText with a validator method, all works (also with the 3.2.2) but if I put inside the inputText a beanValidator (to validate the annotations I putted in the bean) it stop working.

      Here there is the XHTML:

      <h:outputLabel value="E-mail" for="emailNL" style="font-weight: bold;"></h:outputLabel>
      <h:inputText label="Email" id="emailNL" value="#{newsletterHelper.newsletter.email}" validator="#{newsletterHelper.validaEmailNewsletter}" required="true">
       <rich:beanValidator />
      <h:message id="error" for="emailNL" errorClass="errorMessage"></h:message>

      and here the validator method:

       public void validaEmailNewsletter(FacesContext context, UIComponent toValidate, Object value) throws ValidatorException {
       if (isEmailInserita((String)value)) { // se c'è già
       FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Attenzione: l'indirizzo email è già stato registrato", "Attenzione: l'indirizzo email è già stato registrato");
       throw new ValidatorException(message);

      what's wrong?


      Demetrio Filocamo