1 2 Previous Next 17 Replies Latest reply on Sep 8, 2010 2:16 AM by kragoth Go to original post
      • 15. Re: Validation for rich:calendar
        kragoth

        OK, just did a quick google on JSF validator on null value and sure enough what I said is most definitely the problem.


        If you look at the results of doing that google search you will find a number of suggestions in some of the threads on how to deal with it.


        First of all, if these fields are ALWAYS required to be entered then the solution is easy. Just add the required=true attribute to the component and that will fix it. Then use the requiredMessage=* Date Required to make your message look the way you want it to.


        However, if the users are able to leave both blank and use other options then your solutions become slightly more difficult.


        Probably the most technically elegant solution is to subclass the component and override the method that chooses not to send null values to the validator. Unfortunately if you have not extended a richfaces component before then this will take some time to learn how to do. But, if you are willing to spend a few hours/or up to a day or 2 to learn how to do this then later on it will be of the most benefit to you. As then introducing custom components will be something you are already familiar with.


        Alternatively there is a possibility of using a converter to generate the messages in a very similar way to the way your validator works now. I'm not sure exactly how successful this method will be especially if you are using it on a page that uses an ajax validation where bypassUpdate=true.


        Hopefully, this is enough for you to start looking at a solution that will work for you. :D

        • 16. Re: Validation for rich:calendar
          eswaramoorthy1986

          Thanks Tim


          Your information helped to me more.



          Now i use ajax validation, and it works fine




          Thanks


          Eswar

          • 17. Re: Validation for rich:calendar
            kragoth

            Great! Glad you got it working. :)

            1 2 Previous Next