Rene O created MYFACES-3903: ------------------------------- Summary: Allow custom validation message per validator Key: MYFACES-3903 URL: https://issues.apache.org/jira/browse/MYFACES-3903 Project: MyFaces Core Issue Type: Improvement Affects Versions: 2.2.3 Environment: myfaces 2.2.3, java 7, tomcat 7 Reporter: Rene O
At the moment only this is possible: {code} <h:inputText value="#{myBean.value}" validationMessage="My validation message"> <f:validateLength minimum="1" maximum="30"/> <f:validateRegex pattern="^\d{5}$" /> </h:inputText> {code} You can't define a validation message per validation event, but only one message for all validations. As a workaround you can write a custom validator, which contains all validations rules, and then throw ValidatorExceptions containing your desired messages. I think, that this limits the usablity. It should be possible to do the following without writing a custom validator {code} <h:inputText id="myFieldA" value="#{myBean.value}"> <f:validateLength minimum="1" maximum="5" validationMessage="My custom validation message for validateLength"/> <f:validateRegex pattern="^\d{5}$" validationMessage="My custom validation message for validateRegex"/> </h:inputText> <h:inputText id="myFieldB" value="#{myBean.value}"> <f:validateLength minimum="1" maximum="5" validationMessage="Another custom validation message for validateLength"/> <f:validateRegex pattern="^\d{5}$" validationMessage="Another custom validation message for validateRegex"/> </h:inputText> {code} -- This message was sent by Atlassian JIRA (v6.2#6252)