Good evening. I'm breaking my head with a problem that seemed simple
I have a form with some fields, while selecting a combobox I want to hide and display some fields. I'm using 'p: ajax' to run the update.
And in the fields to hide, I'm using 'rendered'.
Everything works perfectly if I run 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 case it would be:
<p:ajax update="pam:lblSexo" event="change" />
Could someone 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>
Thanks for the help.