Reputation: 13571
The default implementation of rich:calendar renders the message "Value must be a date" when used like this and the user enters an invalid date, e.g. "13/13/2011".
<h:column>
<f:facet name="header">Opt-out Date</f:facet>
<rich:calendar datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />
</h:column>
The tag is pulling this key from messages_en.properties by default javax.faces.converter.DateTimeConverter.DATE=Value must be a date
I want the message to be 'Opt-out Date must be a date.'
Failed Attempt #1:
<h:column>
<f:facet name="header">Opt-out Date</f:facet>
<rich:calendar validatorMessage="Opt-out Date must be a date." datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />
</h:column>
Failed Attempt #2 Create properties file entry:
validate.dateEntry={0} must be a date.
Then reference it:
<rich:calendar validatorMessage="validate.dateEntry" label="Opt-Out Date" datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />
Failed Attempt #3
<rich:calendar validatorMessage="#{statusMessages.addToControlFromResourceBundle('Opt in Date',validate.dateEntry)}" label="Opt Out Date" datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />
There is a wrong assumption that I'm making or concept that I'm not grasping. Guidance greatly appreciated.
Upvotes: 3
Views: 2815
Reputation: 1108782
That's a conversion error, not a validation error. Use converterMessage
, not validatorMessage
.
Upvotes: 3