1

I have a flow defining a helper that submits correctly the data

<var name="contactForm" class="my.package.bean.ContactFormHelper"/>

To get some data based on user input I use in the view an ajax call on the binded attribute String id in this way:

<h:panelGroup >
    <p:outputLabel for="id" value="ID" />
    <p:inputText id="id" required="true" value="#{contactForm.id}" label="ID">
        <f:ajax 
            event="change" 
            listener="#{contactController.identifyCustomer(contactForm)}" 
            render="anotherPanel" 
        />
        <p:clientValidator/>
    </p:inputText>
    <p:message for="id" />
</h:panelGroup>

But when identifyCustomer is executed only the field where ajax is placed (String id) is updated. The rest of fields are filled with default values.

LOG TRACE

[21/11/16 17:10:12:508 CET] 0000007a SystemOut O DEBUG [WebContainer : 0 : 8610ff45-f4c5-4faf-a370-efa36701bc01] - ContactForm[name=, surnames= , nif=46713535Y]

Some idea of why is this happening?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
joc
  • 1,336
  • 12
  • 31
  • There is only one field in the example... [mcve] please (and did you try a `p:ajax`?) – Kukeltje Nov 21 '16 at 17:26
  • 2
    Read this http://stackoverflow.com/questions/25339056/understanding-primefaces-process-update-and-jsf-fajax-execute-render-attributes answers your question I think – Kukeltje Nov 21 '16 at 17:50

1 Answers1

1

I've found a solution with process using @this and fields separated by commas:

<p:ajax 
    event="change" 
    listener="#contactController.identifyCustomer(contactForm)}"
    <!-- add process with the fields to bind -->
    process="@this name,surname1,surname2"
    update="newCustomerPanel" 
/>

Hope it help to others.

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
joc
  • 1,336
  • 12
  • 31