2 Replies Latest reply on Dec 17, 2007 6:54 AM by Pete Muir

    problem displaying custom validation message

    Jeremy MARC Newbie

      hi all,

      I have a problem trying to diplay validation error with facesMessages.addToControlFromResourceBundle : no message is displaying on the client side.
      I am using a custom validator:

      <a4j:region renderRegionOnly="true">
      <h:inputText id="email" value="#{account.email}" styleClass="text" required="true" tabindex="2">
      <a4j:support event="onchange" reRender="emailMsg" />
      <f:validator validatorId="validators.checkMailUnicity" />
      <a4j:outputPanel id="msg" ajaxRendered="true">
      <h:message id="emailMsg" for="email" styleClass="errors" /> </a4j:outputPanel>

      and the server side :
      public void validate(FacesContext context, UIComponent component,
       Object value) throws ValidatorException
      String email = (String) value;
      if (!isEmailAvailable(email))
      facesMessages.addToControlFromResourceBundle(component.getClientId(context), "AccountAlreadyExist");

      Thank you