3 Replies Latest reply on Oct 27, 2010 6:29 AM by Sascha Janz

    calendar onchange

    Sascha Janz Master

      i need to update some variables when calender is changed. so i used ajaxsupport with onchanged.

       

      but this only works if it is changed via the popup.

       

      if i change it in textbox nothing happens.

       

      if  i use event oninputchange it works for textbox but not popup.

       

      if i use both events the app crashes, because of component not found.

        • 1. Re: calendar onchange
          Ilya Shaikovsky Master

          checked at demosite for 3.3.3.Final.4

          <rich:calendar value="#{calendarBean.selectedDate}"
          locale="#{calendarBean.locale}"
          popup="#{calendarBean.popup}"
          datePattern="#{calendarBean.pattern}" enableManualInput="true"
          showApplyButton="#{calendarBean.showApply}">
          <a4j:support event="onchanged"/>
          <a4j:support event="oninputchange"/>
          </rich:calendar>

                                   <rich:calendar value="#{calendarBean.selectedDate}"

                                        locale="#{calendarBean.locale}"

                                        popup="#{calendarBean.popup}"

                                        datePattern="#{calendarBean.pattern}" enableManualInput="true"

                                         showApplyButton="#{calendarBean.showApply}">

                                         <a4j:support event="onchanged"/>

                                         <a4j:support event="oninputchange"/>

                                         </rich:calendar>

          works fine for me.

          • 2. Re: calendar onchange
            Sascha Janz Master

            ok, thank you for checking this.

             

            my pages a generated via code. 

             

            how can i put multiple ajaxsupport to a component. i know i must use facet, right?

             

            my code is

             

             

            if (type.compareTo(DynamicContent.TYPE_A4J_SUPPORT) == 0) {

            HtmlAjaxSupport

             

             

            ret =

            this.createAjaxSupport(map);

             

            log.debug("add aj4sup to " + last_comp.getId());

             

            last_comp.getFacets().put("a4jsupport", ret);

             

            }

             

            • 3. Re: calendar onchange
              Sascha Janz Master

              ok, got it. for multiple a4jsupport i must use numbered a4jsupport for id and facet

               

              so

               

              last_comp.getFacets().put("a4jsupport1", comp1);

               

              and so on will work. but note comp.getId() must be same as facet name