3 Replies Latest reply on Jul 22, 2009 2:10 PM by Joe Maglio

    get value of rich:calendar for validation

    Joe Maglio Newbie

      I am trying to get the date value from a <rich:calendar> to validate that it is before another date, but it is null. Here is the general idea, please let me know what is wrong:

      <h:form id="searchForm">

      <rich:calendar id="fromDate" />

      <rich:calendar id="toDate"
      <f:attribute name="fromDate" value="searchForm:fromDate" />


      public void checkDates(FacesContext context, UIComponent component, Object value) {

      String fromDate = (String) component.getAttributes().get("fromDate");
      // This 'date' is null:
      HtmlCalendar date = (HtmlCalendar) context.getViewRoot().findComponent(fromDate);
      Date startDate = (Date) date.getData();

      if( !(startDate.before(endDate) ){

      Thanks in advance