I'm facing an issue where I need to disable a checkbox when a certain option is selected from a dropdown inside a datatable in my xhtml file. The dropdown has options like L, C, UV, and more, and when "L" is chosen, the checkbox should be disabled.
Below is a snippet of the relevant xhtml code for the dropdown and checkbox:
<r2i4:selectForClass itemClass="VehicleGenericType" value="#{vc.vehicleGenericType}" rendered="#{vc.crudState == null || vc.crudState == 'CREATE'}"
valueChangedListener="#{vehicleCategory.vehicleDropdownChange">
<f:selectItems value="#{vehicleCategory.vehicleChanged}" />
<p:ajax />
</r2i4:selectForClass>
<f:facet name="input">
<p:selectBooleanCheckbox id="departmental" value="#{vc.isDepartmental}" rendered="#{vc.crudState == null || vc.crudState == 'CREATE'}"
disabled="#{vehicleCategory.vehicleChanged eq 'L'}"/>
</f:facet>
In the bean file, the following code is used:
public void vehicleDropdownChange(ValueChangeEvent e) {
if(e.getNewValue().equals("L")) {
}
}
Seeking suggestions on how to make this functionality work effectively. Any help is appreciated!
Thank you