2 Replies Latest reply on Oct 26, 2010 6:15 AM by ilya_shaikovsky

    How to validate date in calendar?

    ziyang

      I did some research and the outcome is "The date correction is done based on the pattern date you use and it's done on the client."

      Now, if I input some random stuff like "dfasdf" into the calendar input, a message will be print out in server console "sourceId=registerForm:j_id17[severity=(ERROR 2), summary=(registerForm:j_id17: '
      fasdf' could not be understood as a date.), detail=(registerForm:j_id17: 'fasdf'
      could not be understood as a date. Example: 10/25/10)]"

       

      How could I know the input is not correct? I want to know if the input is correct from some mechanism and then do something to tell the users they are wrong.(For example, set the bg color of the input into red)

       

      Thank you very much.

        • 1. Re: How to validate date in calendar?
          liuliu

          hi,

          I dont think RF has this kind of build-in function .But you can give a lable to your calendar, and define

          javax.faces.converter.DateTimeConverter.DATE and
          javax.faces.converter.DateTimeConverter.DATE_detail

          to make the message more comprehensive.

          • 2. Re: How to validate date in calendar?
            ilya_shaikovsky

            use onchanged for example to trigger some client side validation additionally. our built-in validation triggers when you entering something and then opening the popup in order to check if that is a valid date and popup could be opened to reflect it.