I have problem with JSF I want to be develop an interface that allows the user to disable the SelectOneMenu
when the select the all options of the radio button and when they select the select one option the SelectOneMenu
should be enabled this should be done via AJAX. This part is working but the problem is that when the SelectOneMenu
is active and the user select one value in the dropdown the value="#{tripsForm.rh_name}"
is not available in the backing bean or not binding to the field in backing bean which is rh_name
. I wrapped the SelectOneMenu
in a panelGrid
but this does not seem to work also. the code for xhtml...and the method for disabling SelectOneMenu
...
<h:selectOneRadio id="rhNameStatus" valueChangeListener="#{tripsForm.disableInput}" >
<f:selectItem itemValue="false" itemLabel="Select One Right Holder" />
<f:selectItem itemValue="true" itemLabel="Select All Right Holder"/>
<p:ajax event="click" update=":form1:rhpanellanding" />
</h:selectOneRadio>
<p:panelGrid id="rhpanellanding" columns="2" style="width: 50%">
<h:outputLabel for="rh_namelanding" value="Right Holder Name"/>
<p:selectOneMenu id="rh_namelanding" value="#{tripsForm.rh_name}" rendered="true" effect="fold" editable="false" disabled="#{tripsForm.disabled}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{backingBeanTripDA.rh_nameList()}" />
</p:selectOneMenu>
</p:panelGrid>
public void disableInput(ValueChangeEvent event){
String selectedVal= event.getNewValue().toString();
if("true".equalsIgnoreCase(selectedVal)){
disabled=true;
} else if("false".equalsIgnoreCase(selectedVal)){
disabled=false;
}
}
`