0 Replies Latest reply on Mar 17, 2008 10:32 AM by Martin Ahrer

    rich:message does not show validation message in tabular for

    Martin Ahrer Newbie

      A tabular form is validating a input field using a validator method binding plus a standard f:validateLength validator.

      <rich:dataTable value="#{menuAdminController.selectedObject.attributes}" var="attribute" id="attributesTable">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Login" />
       </f:facet>
       <h:inputText id="login" value="#{attribute.login}" required="false"
       valueChangeListener="#{attribute.userValueChanged}" validator="#{attribute.validateUser}">
       <f:validateLength maximum="5" />
       <!-- TODO: validatorMessage does not get displayed here -->
       </h:inputText>
       <rich:message for="login" />
       </rich:column>
      </rich:dataTable>
      <a4j:commandButton value="#{applicationResources['command.store']}" action="#{menuAdminController.storeAttributes}"
       oncomplete="if (!hasFacesMessages) Richfaces.hideModalPanel('editPanel');" />


      After submitting the form (an a4j:form inside an rich:modalPanel) only the message produced by f:validateXXX tag is shown but not the one created by the method validateUser.

      The validateUser method gets called and throws a ValidatorException


      public void validateUser(FacesContext context, UIComponent component, Object value) throws ValidatorException {
       if (value == null || ((String) value).length() == 0) {
       return;
       }
       try {
       throw new ValidatorException(new FacesMessageSupport().newFacesMessage(FacesMessage.SEVERITY_ERROR,
       message));
       } catch (DataAccessException e) {
       throw new ValidatorException(new FacesMessageSupport().newFacesMessage(e));
       }
      }


      The debugger shows that all validator messages are associated with the right component (i.e. all messages have the same clientId associated)
      FacesContext.getCurrentInstance().getClientIdsWithMessages()


      Hmm.. anybody with some idea