JBoss Richfaces: how to provide another validation message: a calendar from an xhtml implementation?

The default implementation of rich: calendar displays the message "The value must be a date" if it is used like this, and the user enters an invalid date, for example. "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 pulls this key from messages_en.properties by default javax.faces.converter.DateTimeConverter.DATE = The value must be a date

I want the message to be . The date of withdrawal must be a date.

Failed to try # 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 a properties file entry:

validate.dateEntry={0} must be a date.

Then refer to it:

<rich:calendar validatorMessage="validate.dateEntry" label="Opt-Out Date" datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />

Failed to try # 3

<rich:calendar validatorMessage="#{statusMessages.addToControlFromResourceBundle('Opt in Date',validate.dateEntry)}" label="Opt Out Date" datePattern="MM/dd/yyyy" enableManualInput="true" value="#{dtl.withdDt}" />

, , . .

+3
1

, . converterMessage, validatorMessage.

+3

Source: https://habr.com/ru/post/1791559/


All Articles