0
good night. I’m racking my brain with a problem that seemed simple
I have a form with some fields, when selecting a combobox I want to hide and display some fields. I am using p:ajax to perform the update.
And in the fields to hide, I’m using' rendered'.
Everything works perfectly if I execute the command:
<p:ajax update="frmCad" event="change" />
This practice is not legal because it always resets all other fields that will already be filled. However, if I set the specific field to update, it does nothing. In this case it would be:
<p:ajax update="pam:lblSexo" event="change" />
Someone could give me a light?
In short, my code is as follows::
<h:form id="frmCad" prependId="false">
<p:accordionPanel id="pam" multiple="true" activeIndex="0,1">
<p:tab id="tbCad" title="Cadastro" >
<h:panelGrid id="gp1" columns="3" columnClasses="primeiraColumnP">
<h:outputLabel id="lblSegPessoa" for="id" value="Pessoa: " styleClass="estilolabelCampos" />
<p:selectOneRadio id="optTipo" value="#{pessoaBeanView.objetoSelecionado.pes_tipo_pessoa}">
<f:selectItem itemLabel="Física" itemValue="Fisica" />
<f:selectItem itemLabel="Jurídica" itemValue="Juridica" />
<p:ajax update="pam:lblSexo" event="change" />
</p:selectOneRadio>
<p:outputLabel id="lblSexo" value="Sexo: " rendered="#{pessoaBeanView.objetoSelecionado.pes_tipo_pessoa == 'Fisica'}" />
...fechamentos>
I appreciate the help.
Is your bean Viewscoped? I believe it is from Request, so the other fields are reset.
– Giuliana Bezerra