Update an h: database outputText from a p: autoComplete

1

I have a health care application and I have the following question: When I use the p:autoComplete component of PrimeFaces to search for the name of the patient that has the dataNascimento attribute, I want the h:outputText to receive the age coming from database.

<p:autoComplete id="nome"
                value="#{cadastroPrimeiraConsultaBean.pessoa.nome}" 
                completeMethod="#{cadastroPrimeiraConsultaBean.porNome}"  
                var="pessoa" itemLabel="#{pessoa.nome}" itemValue="#{pessoa}"
                forceSelection="true" dropdown="true" />

<p:outputLabel value="Data de Nascimento:" for="dataNascimento" />
                <h:outputText  value="cadastroPrimeiraConsultaBean.pessoa.dataNascimento id="dataNascimento"/>

Could you help me with how to solve this problem.

  

    
asked by anonymous 14.04.2015 / 14:08

1 answer

1

Try adding to your autoComplete:

<p:ajax event="itemSelect" update="IDdoOutPutText" process="@this"/>

If you do not set the patient, add a listener to set the patient in your bean, in the same ajax.

    
14.04.2015 / 16:39