1 Reply Latest reply on Feb 3, 2009 6:28 AM by Ilya Shaikovsky

    rich:calendar invoke diferent method when selecting date and

    canvic jiang Newbie

      Hello, I want to invoke different method when selecting date and month.
      i.e., there are two method , method1 and method2 in backing bean.
      When I select a date, I just want to invoke method1, when changing month I just want to invoke method2.
      But when selecting the date for the first time method1 and also method2 will be invoked. How to modify?

      page code:

      <rich:calendar valueChangeListener="#{bean.handleDateChange}" currentDateChangeListener="#{bean.handleDateChange2}">
       <a4j:support event="onchanged"></a4j:support>
       <a4j:support event="oncurrentdateselected"></a4j:support>
      </rich:calendar>
      


      backing bean code:
       public void handleDateChange(ValueChangeEvent event){
       Date date = (Date) event.getNewValue();
       System.out.println(date);
       }
      
       public void handleDateChange2(CurrentDateChangeEvent event){
       Date date = event.getCurrentDate();
       System.out.println(date);
       }