I'm using primefaces and working on a complex form. I need to hide a part of the form, depending on the value of a checkbox
<p:selectBooleanButton id="input1" .... />
<p:inputText id="input2" />
<!-- the boolean checkbox -->
<p:selectBooleanCheckbox id="checkBox1" value="#{bbean.someBoolValue}" >
<p:ajax event="change" update=":#{p:component('someParentcComponentsId')}" />
</p:selectBooleanCheckbox>
<!-- some input fields here. These will be rendered depending checkBox1 value -->
<p:panel rendered="#{bbean.someBoolValue}" id="hiddingPanel">
<h:panelGrid columns="2" >
<p:inputText id="input3" />
</h:panelGrid>
</p:panel>
So far, I've made that work, so when checkBox1
is clicked, hiddingPanel
is getting shown or hidden. But there's a catch: the values of every input in that form ( e.g. input1
, input2
) are lost, since the 'change' ajax event is not submitting their values.
How could I make sure that all input values are submitted before updating the form ?