I am making a Java/HTML program using Seam. I am trying to get an <h:selectOneMenu>
to show up when a <h:selectBooleanCheckbox>
is checked. I got it to do it by using "onclick="form.submit()" in the checkbox and putting the drop-down in an <s:div rendered>
, but whenever the page reloads, the variable that is being used by the dropdown is reset to the top choice. I'm pretty sure it is because of the <s:div>
. Does anyone know how I can make it keep the correct choice in the drop-down? Thank you.
Here is the code for the checkbox and the drop-down:
<h:selectBooleanCheckbox id="checkbox" value="#{printLabel.code}" label="barcode" onclick="changeDropdowns()"/>
<br />
<s:div rendered="#{printLabel.code}">
<h:outputLabel id="locationLabel" value="   Location"/>
<h:selectOneMenu id="locationDrop" value="#{printLabel.codeLoc}">
<f:selectItems value="#{printLabel.getBarcodeTypes()}" />
</h:selectOneMenu>
</s:div>