2 Replies Latest reply on Oct 30, 2008 6:44 PM by Brian Ray

    Disabling rich:calendar via JavaScript

    Lance Buchan Newbie

      Hi

      I'm trying to disable a rich:calendar component (configured as a popup) programmatically from JS. I am able to disable the InputDate component but the PopupButton is not disabled (still pops the calendar on click) when I set disabled = true on the InputDate DOM component.

      What's the best way to do this (preferably without having to change the image reference for the button..)?

      Help much appreciated
      Lance

        • 1. Re: Disabling rich:calendar via JavaScript
          Lance Buchan Newbie

          This solved it:

           <h:panelGrid columns="3">
           <h:selectBooleanCheckbox value="#{bean.selected}">
           <a4j:support event="onchange" reRender="cal"/>
           </h:selectBooleanCheckbox>
           <h:selectOneMenu value="#{bean.pattern}">
           <a4j:support event="onchange" reRender="cal"/>
           <f:selectItem itemLabel="dd/MMM/yyyy" itemValue="dd/MMM/yyyy"/>
           <f:selectItem itemLabel="dd-MM-yy" itemValue="dd-MM-yy"/>
           </h:selectOneMenu>
           <rich:calendar id="cal" value="#{bean.date}"
           popup="true"
           datePattern="#{bean.pattern}"
           showApplyButton="false"
           style="width:200px"
           disabled='#{bean.selected == true}'/>
           </h:panelGrid>
          


          - Lance

          • 2. Re: Disabling rich:calendar via JavaScript
            Brian Ray Newbie

            I might be slow. But I would like to do exactly what you are trying to do with JS only, no call to the bean. I have tried setting disabled in the JS which works fine for IE but in FF it still allows the click on the image to fire. I alos replaced the images but still seem to have a listener attached no matter what image is showing.

            Does anyone know how to do this in pure JS?

            TIA B.