1 2 Previous Next 17 Replies Latest reply on Feb 28, 2012 3:14 PM by vasuatkkd

    RichFaces validation not firing

    Arbi Sookazian Master

      please see this topic: http://www.seamframework.org/Community/SeamValidatorNotBeingExecuted

       

      I am wondering if this is a RF-related problem?

       


      The javascript validation is not a preferred solution:

       

      <rich:calendar id="rateCategoryEffectiveDate"
                              inputClass="dateField"
                              required="false"
                              value="#{merchantBillingGroupEditorUI.rateCategory.priceEffectiveDate}"
                              oninputkeypress="return restrictDate(this, event);"
                              oninputchange="return checkNoPastDate(this);"
                              datePattern="MM/dd/yyyy"
                              enableManualInput="true"
                              isDayEnabled="isDayEnabled"
                              dayStyleClass="getDisabledStyle"                       
                              label="#{messages['/restricted/billing/add_merchant_billing_group_wizard_step1.xhtml/field.effectiveDate']}">
                          </rich:calendar>

       

      or this:

       

      <rich:calendar  inputClass="dateField"
                                                  disabled="#{pageaction == 'view'}"
                                                  required="true"
                                                  value="#{rateCategory.rateCategory.priceEffectiveDate}"
                                                  oninputkeypress="return restrictDate(this, event);"
                                                  oninputblur="return checkNoPastDate(this);"
                                                  datePattern="MM/dd/yyyy"
                                                  enableManualInput="true"        
                                                  isDayEnabled="isDayEnabled"
                                                  dayStyleClass="getDisabledStyle"                  
                                                  label="#{messages['/restricted/billing/add_merchant_billing_group_wizard_step1.xhtml/field.effectiveDate']}">
                                  </rich:calendar> 

       

      is it possible to use validator attribute with rich:calendar?  I'm assuming yes, b/c it works with book.xhtml (hotel booking example) with my Seam validator component.  But not sure why it's not working in my xhtml???

        • 1. Re: RichFaces validation not firing
          Ilya Shaikovsky Master

          1) if it will be called if defined at just stanadrd input?

          2) please try it under latest 3.3.3 B1 from the beggining.

          • 2. Re: RichFaces validation not firing
            Arbi Sookazian Master

            what does this mean?

             

            "1) if it will be called if defined at just stanadrd input?"

             

            sorry I don't understand.  standard calendar rather than rich:calendar?  I don't think there is a h:calendar component...

            • 3. Re: RichFaces validation not firing
              sv kap Newbie

              Hi.

               

              I am having the same problem with my calendar component. The validation is not fired. The calendar component is in a form with several other fields (they are validated just fine). I am using RF 3.3.3 Beta 1.I have tried using unly validator="#{profileBean.validateBirthdate}"; using only  <rich:ajaxValidator event="oninputblur" /> <f:validator validatorId="birthDateValidator" />; using both as it is in the code I have given below but nothing helped.

               

                                              <h:panelGrid columns="3"
                                                  columnClasses="pnlGrdClassCal, pnlGrdClass, pnlGrdClassLong">
                                                  <h:outputLabel id="birthdateLabelId" for="birthdateCalendarId"
                                                      value="Birthdate:" style="line-height:200%" />
                                                  <rich:calendar id="birthdateCalendarId" locale="en/US" popup="true"
                                                      datePattern="dd/M/yyyy" showApplyButton="false"
                                                      cellWidth="24px" cellHeight="22px" mode="ajax"
                                                      value="#{profileBean.birthdate}"
                                                      validator="#{profileBean.validateBirthdate}">
                                                     
                                                      <rich:ajaxValidator event="oninputblur" />
                                                      <f:validator validatorId="birthDateValidator" />

                                                  </rich:calendar>
                                                  <rich:message id="birthdateMsg" for="birthdateCalendarId"
                                                      errorClass="errorMessage" />
                                              </h:panelGrid>

               

              public void validateBirthdate(FacesContext context, UIComponent component,
                          Object value) throws Exception {

              .......

              ....

              }

              • 4. Re: RichFaces validation not firing
                Ilya Shaikovsky Master
                I mean t check with h:inpitText
                • 5. Re: RichFaces validation not firing
                  Arbi Sookazian Master
                  It works with h:inputText, not rich:calendar in my facelet.
                  • 6. Re: RichFaces validation not firing
                    Ilya Shaikovsky Master

                    just modified richfaces-demo sample page to:

                    <rich:calendar value="#{calendarBean.selectedDate}"
                         locale="#{calendarBean.locale}"
                         popup="#{calendarBean.popup}"
                         datePattern="#{calendarBean.pattern}"
                          showApplyButton="#{calendarBean.showApply}" cellWidth="24px" 
                            cellHeight="22px" style="width:200px" validator="#{calendarBean.validateBirthdate}"/>
                    <a4j:commandButton value="click"></a4j:commandButton>
                    
                    and added
                         public void validateBirthdate(FacesContext context, UIComponent component,
                            Object value) throws Exception {
                             System.out.println("CalendarBean.validateBirthdate()");
                         }
                    

                    to the CalendarBean.

                     

                    see in the consove that method properly called.

                    • 7. Re: RichFaces validation not firing
                      Ilya Shaikovsky Master

                      modified to:

                      <rich:calendar value="#{calendarBean.selectedDate}"
                           locale="#{calendarBean.locale}"
                           popup="#{calendarBean.popup}"
                           datePattern="#{calendarBean.pattern}"
                            enableManualInput="true"
                            showApplyButton="#{calendarBean.showApply}" cellWidth="24px" cellHeight="22px" 
                              style="width:200px" validator="#{calendarBean.validateBirthdate}">
                                <rich:ajaxValidator event="oninputblur"/>
                      </rich:calendar>
                      

                       

                      two results:

                      if date entered manually converted successfully by default converter - validateBirthdate called. If date entered for examples as "justNotConvertableDateString"  - it will not be called as conversion already failed.

                      • 8. Re: RichFaces validation not firing
                        Arbi Sookazian Master
                        Which build do I need to download to test this?
                        • 9. Re: RichFaces validation not firing
                          Ilya Shaikovsky Master
                          I'm using 3.3.3 SNAPSHOTS for checking.
                          • 10. Re: RichFaces validation not firing
                            Arbi Sookazian Master
                            So was there a JIRA for this or nobody ever reported this problem?
                            • 11. Re: RichFaces validation not firing
                              sv kap Newbie

                              I found the problem. I am using version 3.3.3 BETA 1. When input is clicked the validation is called successfully. But when the button is used to open the calendar then no validation is called. This should be bug in the component...

                              http://i45.tinypic.com/5f0ymo.jpg

                               

                              There is another problem as well. For some reason reason the first time date is selected the validation is not called. After that the validation is called with the previous value. For example if I change the date in the picture above to sth else the validation will not be called with the last value but with 22/10/1984 instead.

                              • 12. Re: RichFaces validation not firing
                                Ilya Shaikovsky Master

                                1) when you choosing date using button for calling popup(without focus in input) - request even not sent because inputblur not occurs.

                                2) It seems the problem is the same for second problem. You choosing date from popup then after you opening it again - blur happens as the focus was in input and the date selected previously sent to server. After you selecting new date - no blur occurs (as it was already fired) and nothing sent. But on next click to the button - it sent again.

                                 

                                 

                                try to use onchanged handler.

                                • 13. Re: RichFaces validation not firing
                                  sv kap Newbie
                                  It's working fine now. Thank you
                                  • 14. Re: RichFaces validation not firing
                                    Ole Hansen Newbie

                                    Hi,

                                     

                                    I'd like to revive this topic, because calendar validation doesn't fire in my application using Richfaces 3.3.3 Final Libs:

                                     

                                    <rich:calendar locale="deDe" popup="true" datePattern="dd.MM.yyyy" validator="#{AddHolidayBean.validateBirthdate}">

                                           <rich:ajaxvalidator event="onchanged" />

                                    </rich:calendar>

                                     

                                    BaseBean (AddHolidayBean extends from it):

                                    public void validateBirthdate(FacesContext context, UIComponent component, Object value) {

                                          System.out.println(new Throwable().getStackTrace()[0]);

                                    }

                                     

                                    This does not output to console.

                                     

                                    EDIT: Code works using 3.1.3SP1, even without the rich:ajaxvalidator tag. But I kinda need it working under 3.3.3, if someone has an idea.

                                     

                                    Greetings

                                    1 2 Previous Next