8 Replies Latest reply on Sep 29, 2009 9:00 AM by asm web

    rich:calendar does not show the current date

    Krishnakanth Rao Newbie

      I have a rich:calendar component where popup is true and uses a calendardata model
      The currentDate attribute is set to a Date attribute in the backing bean

      <rich:calendar id="CalendarID" value="#{calendarBean.selectedDate}" timeZone="#{calendarBean.timeZone}" datePattern="dd-MM-yyyy" showApplyButton="true" popup="true" enableManualInput="true" currentDate="#{calendarBean.startDate}">

      I have a combo box where the user can select the year. It invokes a method in the backing bean when the year is changed

      <rich:comboBox id="calendarYear" value="#{calendarBean.year}" enableManualInput="false" width="300">
       <a4j:support event="onchange" actionListener="#{calendarBean.yearChanged}" ajaxSingle="true" reRender="CalendarID"/>
       <a4j:support event="onselect" actionListener="#{calendarBean.yearChanged}" ajaxSingle="true" reRender="CalendarID"/>
       <f:selectItems value="#{calendarBean.possibleYears}"/>

      public void yearChanged(ActionEvent event)
       Calendar c = Calendar.getInstance();
       c.set(Integer.parseInt(year), Calendar.JANUARY, 01);
       startDate = c.getTime();
       System.out.println("in yearchanged() startDate::"+startDate);

      If 2010 is shown the startDate is set to Jan 01, 2010
      The issue is that when I click on the calendar component it still shows the todays date and not Jan 01, 2010