1

Is it possible to disable rich:calendar component in Richfaces 4.3.1? I have rich:calendar and a rich:inputText. The requirement is user can select either of these components. For eg..if user enters data in inputtext, the calendar component should get disabled. I tried with "disabled" attribute. But it doesn't work. However it works fine with Richfaces 3.3.3.

Any suggestion is appreciated. Thanks!

UPDATE: The calendar component that we are using should allow manual input as well as popup. The requirement is to disable the calendar component when user selects the radio button corresponding to inputtext.

XHTML Page:

<h:selectOneRadio name="searchCriteria" layout="pageDirection"
id="searchCriteria" value="#{searchBean.searchvalue}">
<f:selectItem itemLabel="Joining Date:" name="joinDate"
    itemValue="joinDate" />
<f:selectItem itemLabel="Student #:" name="studentNbr"
    itemValue="studentNbr" />
<a4j:ajax immediate="true"
    render="fromTime,toTime,studentNumber,studentName"  
               event="click"></a4j:ajax>
</h:selectOneRadio>
<rich:calendar name="fromTime" id="fromTime" datePattern="MM/dd/yyyy"
enableManualInput="true" value="#{searchBean.fromTime}"
disabled="#{searchBean.checkType('studentNbr')}"
converterMessage="Could not be understood as Date">
<rich:placeholder value="From" />
</rich:calendar>
<rich:calendar name="toTime" id="toTime" datePattern="MM/dd/yyyy"
enableManualInput="true" value="#{searchBean.toTime}"
disabled="#{searchBean.checkType('studentNbr')}">
<rich:placeholder value="To" />
</rich:calendar>
<h:inputText value="#{searchBean.studentNumber}" name="studentNumber"
id="studentNumber" disabled="#{searchBean.checkType('joinDate')}"></h:inputText>
<h:inputText value="#{searchBean.studentName}" name="studentName"
id="studentName" disabled="#{searchBean.checkType('joinDate')}">
<rich:placeholder value="Name" />
</h:inputText>

SearchBean.java

public Boolean checkType(String searchvalue) {
    Boolean tmp = this.searchvalue.equalsIgnoreCase(searchvalue);
    return tmp;
}
user2455158
  • 97
  • 3
  • 12
  • I'd question the need of disabling the component in this case. Still, what with disabled isn't working? Are you rerendering the component so it is disabled? Also, there is `enableManualInput` which lets user enter a date in the input box created by the calendar, couldn't you use that? – Makhiel Jun 18 '13 at 08:00
  • @Makhiel, The requirement is just to the calendar component. But when I select radio button corresponding to the inputtext, the calendar component disappears. If I refresh the page, the calendar component appears correctly in disabled state. As for enableManualInput, we set that to true. However, we want to disable both manual input and pop-up. – user2455158 Jun 18 '13 at 11:58

1 Answers1

0

Some components don't like to be the target of a rerender. Put a <a4j:outputPanel id="panel"> around the inputs and instead of render="fromTime,toTime,studentNumber,studentName" do render="panel".

Makhiel
  • 3,874
  • 1
  • 15
  • 21