开发者

JBoss Richfaces: How to provide a different validation message to rich:calendar from within the xhtml implementation?

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>   
      <开发者_JAVA百科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.


That's a conversion error, not a validation error. Use converterMessage, not validatorMessage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜