Michał Piątkowski
Michał Piątkowski

Reputation: 363

Is there a way to update Primefaces form without losing data in it?

I have form inside dialog and I need to update it when user click button. Button is for showing new fields in this form. Fields are not rendered by default in dialog(render="#{gettForBoolean}").

When I am trying to use RequestContext.getCurrentInstance().update(formID); in backing bean and always all data are gone.

Upvotes: 1

Views: 2452

Answers (2)

Lorenzo Lerate
Lorenzo Lerate

Reputation: 3870

The process attribute avoid you loosing data in AJAX calls:

<p:ajax update="formId" actionListener="#{bean.method}" />

Upvotes: 0

Michał Piątkowski
Michał Piątkowski

Reputation: 363

Problem solved. Normal input is not saving to variable when writing, but it can be done by ajax: <p:ajax event="keyup" process="@widgetVar(inputID)"/>

Upvotes: 1

Related Questions