1 Reply Latest reply on Nov 5, 2008 5:39 AM by Ilya Shaikovsky

    rich:calendar and datePattern internal validation

    Piotr Buda Newbie

      Hello,

      I was using rich:calendar recently and as value for datePattern I used some entry from messages.properties file.

      There is a problem however. While the dates are shown properly, the internal validation of the date fails.

      This is a snippet of the page:

      <g3:label value="#{msg.orm_prescription_dialog_period_lblDateStart}:"
       id="lblDateStart" for="calStart"></g3:label>
      <h:panelGrid columns="2"
       columnClasses="g3_calendar_container, g3_error_message">
       <rich:calendar id="calStart" value="#{editOrderBB.date}"
       datePattern="dd.MM.yyyy HH:mm">
       <a4j:support event="ondateselected"
       onsubmit="#{rich:element('formChanged')}.value = 'change';return false;" />
       </rich:calendar>
       <h:message id="calStart_message" for="calStart" />
      </h:panelGrid>
      
      <g3:label value="#{msg.orm_prescription_dialog_period_lblEnd}:"
       id="lblEnd" for="calEnd"></g3:label>
      <h:panelGrid columns="2"
       columnClasses="g3_calendar_container, g3_error_message">
       <rich:calendar id="calEnd" value="#{editOrderBB.dateTo}"
       datePattern="#{loc['datetimePattern_common']}">
       <a4j:support event="ondateselected"
       onsubmit="#{rich:element('formChanged')}.value = 'change';return false;" />
       </rich:calendar>
       <h:message id="calEnd_message" for="calEnd" />
      </h:panelGrid>
      


      The first occurence of the calendar uses hardcoded pattern (just for the purpose of this demonstration) and the second one uses a pattern from an external properties file.

      When a form with these two is submitted, the first calendar return no errors, however the second one indicates that the selected date is in wrong format (value must be a date error message).

      Am I doing something wrong here?