You can have method in your myBean
which is a valueChangeListener event.
private boolean caldisabled; // with getter and setter
public void checkSelectedVal(ValueChangeEvent event){
String selectedVal=event.getNewValue().toString();
if("NO".equalsIgnoreCase(selectedVal)){
caldisabled=true;
} else if("YES".equalsIgnoreCase(selectedVal)){
caldisabled=false;
}
}
And in your view in primefaces calendar
component set disabled
attribute
<h:selectOneRadio value="#{myBean.yesNo}" valueChangeListener="#{mybean.checkSelectedVal}">
<f:selectItem itemValue="yes" itemLabel="YES" />
<f:selectItem itemValue="no" itemLabel="NO" />
<f:ajax event="click" execute="@this" render="mycal"/>
</h:selectOneRadio>
<p:calendar id="mycal" value="#{myBean.date}" disabled="#{myBean.caldisabled}"/>
And there should be another way to do this. I think as this calendar
component is Jquery datepicker
you should be able to do it using scripting alone with no need to go to bean and make ajax call