4 Replies Latest reply on Jun 8, 2011 9:33 AM by jonask

    <rich:calendar> change event richfaces 4

    jonask

      Hi i have a rich:clendar elemnt. The problem is, that only the first time i change a date the bean-setter is invoked. any more changes arent updated...

       

      here the code:

       

       

      <h:form>
                <h:panelGrid columns="3">
                          <a4j:commandButton execute="@this" id="saveButton" action="#{treeBean.invokeSave}" value="Tabelle Speichern" disabled="#{!treeBean.displaySave}" render="undoButton,redoButton,saveButton"/>
                          <rich:column>
                                    <h:outputText value="wirksam ab:" />
                                              <rich:calendar required="false" disabled="#{!treeBean.displaySave}" defaultLabel="kein Datum -> sofort" value="#{treeBean.selectedDate}" id="calendar" locale="treeBean.locale" enableManualInput="true" datePattern="dd.MM.yyyy">
                                                        <a4j:ajax event="change" execute="@this" render="calendar"/>
                                                        <rich:validator/>
                                              </rich:calendar>
                          </rich:column>
                          <rich:message for="calendar"/>
                </h:panelGrid>
      </h:form>
      

       

      is there a different event i could use? like datechanged or sth.?

      i also tried to use the ondateselect attribute and there call a js-function, but that didnt worked for me, neither.

       

      i am trying to realize it together with jsr-303 validation... thanks for your help.

        • 1. Re: <rich:calendar> change event richfaces 4
          nbelaevski

          Hi Jonas,

           

          Does the same reproduce if you remove disabled="#{!treeBean.displaySave}" ?

          • 2. Re: <rich:calendar> change event richfaces 4
            jonask

            Hello Nick, yes, it doesnt matter...

             

            I just noticed that it works every time i refresh the whole page.

             

            So i can 1. select a date and the setter is invoked then i can select more but they arent saved. when i reload the page the last saved date is set and i can save a new one, but only one...

            • 3. Re: <rich:calendar> change event richfaces 4
              paddy3k

              I had the same problem and solved it with the following attribute :

               

              ondateselect="submit"

               

              example:

               

              <h:form>

              <rich:calendar value="#{dateController.selectedStartDate}" id="beginDate" locale="#{dateController.locale}"

                                   popup="#{dateController.popup}" datePattern="#{dateController.pattern}" ondateselect="submit"

                                   showApplyButton="#{dateController.showApply}" cellWidth="24px" cellHeight="22px" style="width:200px"/>

              </h:form>

               

              hope it will help you too

                              

              greets,

              paddy

              • 4. Re: <rich:calendar> change event richfaces 4
                jonask

                yeah thank you thats a possibility. i used ondateselect="document.getElementById('calendarForm').submit(); return false;"

                 

                the only thing is, that my whole site refreshes now when i submit the form...