Both <p:calendar/>
and <p:selectOneMenu>
has disabled
properties. Both component has ajax events, <p:calendar/>
has dateSelect
and <p:selectOneMenu/>
has change
.
So, you need to make a bean method which will return true
or false
according to which selection has been made and bind it to disabled
properties and update these components when selection has been made.
For example JSF part:
<p:calendar id="calendar" value="#{bean.calendar}" disabled="#{bean.calendarDisabled}">
<p:ajax event="change" update="selector calendar" process="@this"/>
</p:calendar>
<p:selectOneMenu id="selector" disabled="#{bean.calendarDisabled != true}">
<p:ajax event="change" update="selector calendar" process="@this"/>
</p:selectOneMenu>
And bean part:
public boolean calendarDisabled(){
if(calendar != null){
return false;
}else{
//...do whatever you needs basing on your requirements
}
}
Also please take a look at Primefaces manual