You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Hoehmann, Andreas" <an...@siemens.com> on 2008/04/11 11:26:52 UTC

validatorMessage is not working

Hello,

If have a inputfield with a validator-binding and i want define the 
validator-message via ui (and *not* in the java-code) ...
 
<h:inputText id="quantity" 
             value="#{bean.quantity}" 
             validator="#{bean.validateInput}"
             validatorMessage="#{bundle['only_multiple_of']} #{bean.totalMinimumOrderQuantity}"
             required="true">
              <f:convertNumber/>
              <a4j:support event="onkeyup" 
                           reRender="inputArea" 
                           limitToList="true" 
                           ajaxSingle="true"
                           ignoreDupResponses="true"
                           requestDelay="500"
                           focus="quantity"/>
</h:inputText>

<rich:message for="quantity" showSummary="true" showDetail="false"/>
<h:message for="quantity" showSummary="true" showDetail="false"/>

public void validateInput(final FacesContext context, final UIComponent component, final Object value) {
    boolean valid = isValid(value);
    if (!valid) {
      // the message should replaced with the "validatorMessage" in the ui
      final FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "hallo", null);
      context.addMessage(component.getClientId(context), facesMessage);
      throw new ValidatorException(facesMessage);
    }
  }

If validation fail then "hallo" is show but not the defined "validatorMessage".

I try this with ri-1.2 and mf-1.2 ... the same result.

Any ideas?

Regards
höhmi