5 Replies Latest reply on Dec 2, 2009 4:26 AM by radu123

    Problems validating rich:calendar

    radu123

      Hi !

      I am trying to validate a rich:calendar for not null input using <rich:beanValidator />, but i am not able to validate for null inputs.

      For example in my constraits.xml file, i validate getter for calendar:


      (works fine)

      (not work)

      <constraintannotation="org.hibernate.validator.constraints.NotEmpty"/> (not work)


      Those last two constraint did not worked because "DateTime" data type dose not recognize them ? (first of them as far as i know is used for numeric values and second one for strings).

      There is such a constraint for date time data type ? Could i validate somehow using constraints written in xml file for not null inputs ?

      I am forced to used required="true" in xhtml for this kind of validation (not null) for rich:calendar (if i am using hibernate validator) ?

      Please if you have an idea help me...

      Regards,
      Radu

        • 1. Re: Problems validating rich:calendar
          radu123

           

          "radu123" wrote:

          Hi !

          I am trying to validate a rich:calendar for not null input using <rich:beanValidator />, but i am not able to validate for null inputs.

          For example in my constraits.xml file, i validate getter for calendar:

          "<"getter name="dateOfBirth">

          "<"constraint annotation="javax.validation.constraints.Past"/> (works fine)

          "<"constraint annotation="javax.validation.constraints.NotNull" /> (not work)

          <constraintannotation="org.hibernate.validator.constraints.NotEmpty"/> (not work)

          "<"/getter>

          Those last two constraint did not worked because "DateTime" data type dose not recognize them ? (first of them as far as i know is used for numeric values and second one for strings).

          There is such a constraint for date time data type ? Could i validate somehow using constraints written in xml file for not null inputs ?

          I am forced to used required="true" in xhtml for this kind of validation (not null) for rich:calendar (if i am using hibernate validator) ?

          Please if you have an idea help me...

          Regards,
          Radu

          Radu


          • 2. Re: Problems validating rich:calendar
            ilya_shaikovsky

            It's standard JSF behavior. Examine validateValue method in UIInput standard JSF class which our input components extends. If you not defined required - validators even will not be called for empty value - it's just marked as valid. We corrected this for a few standard components by overriding this method - but calendar component uses standard UIInput validation mechanism.

            I starded internal discussion on this weird problem and will update you with results.

            Currently seems you have to use required attribute.

            • 3. Re: Problems validating rich:calendar
              radu123

              Hi ,

              Thanks a lot for the message.

              I will try using validateValue method.

              Also i will keep an eye on this forum for new results.

              Regards,
              Radu


              • 4. Re: Problems validating rich:calendar
                alexsmirnov

                I've created feature request in the project JIRA https://jira.jboss.org/jira/browse/RF-8172. I beleive we can fix it for upcoming 3.3.3 release.

                • 5. Re: Problems validating rich:calendar
                  radu123

                  Hi ,

                  Thanks for the message.
                  Ok.
                  I am glad to hear that, i wish you good luck.

                  All the best,
                  Radu