This is my h:selectOneMenu
part where dropdown click show 3 values (A,B & C) on UI (we have domainList method in bean containing A,B, C):
<h:form id="MainForm">
<h:panelGrid columns="1">
<h:selectOneMenu id="domainList" value="#{bean.domain}" listener="#{bean.changeDomainValue}">
<f:selectItem itemLabel="#{msg.abc }"/>
<f:selectItems value="#{bean.dMap.entrySet()}"
var="entry" itemLabel="#{entry.key}" itemValue="#{entry.value}"/>
<f:ajax event="change" render="??????"/>
</h:selectOneMenu>
</h:panelGrid>
This is my concern where if I select Value="C"
from dropdown list I need to add two checkbox in the existing form (an extra field ):
<h:panelGrid columns="2">
<h:outputLabel value="#{msg.box1}"></h:outputLabel>
<h:selectBooleanCheckbox value="#{bean.chkBox1}"></h:selectBooleanCheckbox>
</h:panelGrid>
<h:panelGrid columns="2">
<h:outputLabel value="#{msg.box2} :"></h:outputLabel>
<h:selectBooleanCheckbox value="#{bean.chkBox2}"></h:selectBooleanCheckbox>
</h:panelGrid>
</h:form>
Here is my Bean.java
:
private void changeDomainValue(ValueChangeEvent e) {
if (e.getNewValue() == "C") {
this.chkBox1 = "true";
this.chkBox2 = "true";
} else
this.chkBox1 = "false";
this.chkBox2 = "false";
//return false;
}
Question: what to add on render property so these two checkboxes will populate only if i select domainList= "c"
?