0 Replies Latest reply on Oct 19, 2009 4:42 PM by Piotr Salski

    binding problem

    Piotr Salski Newbie

      I have page with search list result, each result can be edited, on the edit page I have to richcalendar fields startDate and endDate where endDate depends on startDate (endDate cant be earlier from startDate). On startDate I have validator and on endDate I use validator in backingbean.


      <managed-bean>
        <managed-bean-name>EndDateValidator</managed-bean-name>
        <managed-bean-class>pl.polskiraj.validator.EndDateValidator</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
      <validator>
        <validator-id>pl.polskiraj.validator.validateStartDate</validator-id>
        <validator-class>pl.polskiraj.validator.StartDateValidator</validator-class>
       </validator>
      



      startDate:


      <rich:calendar monthLabels="styczeń, luty, marzec, kwiecień, maj, czerwiec, lipiec, sierpień,
                  wrzesień, październik, listopad, grudzień"
                  monthLabelsShort="01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12"
                  datePattern="dd-MM-yyyy"
                  weekDayLabelsShort="N, Pn, Wt, Śr, Cz, Pt, So"
                  todayControlMode="hidden"
                  firstWeekDay="1"
                  required="true"
                  value="#{event.startDate}"
                  binding="#{EndDateValidator.startDateInput}" immediate="true" 
                  >
                  <f:validator validatorId="pl.polskiraj.validator.validateStartDate"/>
                  </rich:calendar>
                  



      endDate:


      <rich:calendar monthLabels="styczeń, luty, marzec, kwiecień, maj, czerwiec, lipiec, sierpień,
                  wrzesień, październik, listopad, grudzień"
                  monthLabelsShort="01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12"
                  datePattern="dd-MM-yyyy"
                  weekDayLabelsShort="N, Pn, Wt, Śr, Cz, Pt, So"
                  todayControlMode="hidden"
                  firstWeekDay="1"
                  required="true"
                  value="#{event.endDate}"
                 validator="#{EndDateValidator.validate}"
                  >



      is startDate I have


      binding="#{EndDateValidator.startDateInput}"



      when I will enter startDate earlier from present I will get message that date is invalid, and that is how it should be.
      When validation fails and I go back to serach result list and try to edit different item from list on the edit page startDate will be from previously edited item and it will be marked as invalid before validation is called. Now if I will remove binding from startDate component it will works fine.
      Not sure If my problem description is understanable :-)


      HOW TO FIX IT?