5 Replies Latest reply on Dec 3, 2010 5:15 PM by Chris Mathrusse

    Preventing certain days from being selected with rich:calendar

    Chris Mathrusse Newbie

      I'm using RichFaces and I am trying to prevent the user from selecting any days on the calendar except for Mondays. I've found some sample code that I modified that seems to work well in disabling all days except for Mondays, but does not prevent the user from selecting those days.




      <script type="text/javascript">

      function isDayEnabled(day){

        var date = new Date(day.date);

        return (date.getDay() == 1); // 1 is Monday, the only day that should be enabled.


      function getDisabledStyle(day){

        if (!isDayEnabled(day)) return 'rich-calendar-boundary-dates disabledDay';









                      <rich:calendar id="cal-start-date"

                          value="#{quote.startDate}" requiredMessage="Date 1 is required."

                          datePattern="MMM d, yyyy" isDayEnabled="isDayEnabled"


                                  required="true" firstWeekDay="0"





      But as you can see from the screenshot below, Mondays are the only days enabled but I can still select any day of the week.


      So how do I prevent the user from selecting all days except for Mondays?


      Thanks for the help...