3 Replies Latest reply on Nov 18, 2010 8:23 AM by Terry Hagan

    Disabling 'clean' button in rich:calendar

    Lance Buchan Newbie

      Hi

      At the bottom of the calendar display, there is a button 'Clean', which allows the user to clear the output date. I need to prevent the user from entering an empty date - how do I disable this button?

      Help appreciated
      Lance

        • 1. Re: Disabling 'clean' button in rich:calendar
          Flavio Henrique Newbie

          For different reasons I need to hide/remove this buttom too.

          Someone can give us a help?

           

          Or... how can I use the Calendar's JS API Function resetSelectedDate() to intercept the onclean event?

           

          Waiting for https://jira.jboss.org/browse/RF-7794

           

          Thank you.

          • 2. Re: Disabling 'clean' button in rich:calendar
            Flavio Henrique Newbie

            Found!

             

            To disable/hide the 'clean' button just remove the control 'cleanControl' from the footer facet... Look the code below.

             

            <r:calendar id="calendarID">
            <f:facet name="footer">
                <h:panelGrid columns="4">
                    <h:outputText value="{todayControl}" />
                    <h:outputText value="{selectedDateControl}" />
                    <h:outputText value="{timeControl}" />
                    <h:outputLabel
                        value="{cleanControl}"
                        onclick="$('#form\\:calendarID').component.resetSelectedDate()" />
                </h:panelGrid>
            </f:facet>
            </r:calendar>
            

             

            The onclick event above resolves the problem that when we hit the 'clean' buttom, the component's value still set. Now I can really clean my calendar.

             

            Hope this helps someone else.

            • 3. Re: Disabling 'clean' button in rich:calendar
              Terry Hagan Newbie

              Hi, thanks for the code, a bit of modification to it and it solves my problem. I don't want the user to be able to see or use the 'clean' button, here's how :

               

              <r:calendar id="calendarID">
              <f:facet name="footer">
                  <h:panelGrid columns="1">
                      <h:outputText value="{selectedDateControl}" />
                  </h:panelGrid>
              </f:facet>
              </r:calendar>

              The only value left in the footer of the calendar control is the selected date.

              cheers!