1 Reply Latest reply on Nov 17, 2009 10:09 AM by ilya_shaikovsky

    rich:calendar - limiting choice of year

    piotr.sobczyk

      Hello, I've read Ilya's article on his blog (http://relation.to/Bloggers/Ilya) showing how to make rich:calendar reduce to month/year selector. The effect is nice and everything works fine.

      The only thing I need now is validation of entered day. I would like to allow users to only select date within let's say next 3 years. Normally I would use standard JSF validation mechanism but I think more user friendly would be just disabling "next year" button in rich:calendar widget when user cant extend beyond current year.

      I think one way could be listening to "oncurrentdateselect" event and canceling next year selection if needed, using Java Script API to get currently selected date but I'm not very good at JS and don't know how to write such code. Can anyone give me sample of code or point me a better way to achieve my goal?

      I would also need to limit years visible in currentMonthControl popup dialog to next 3 years or - if there is no way to reach this - at least disable currentMonthControl popup dialog. Thanks in advance!