How to reset input fields in a form after validation fail when updating it with new values

Solution 1:

Exactly for this purpose, <p:resetInput> component was introduced (based on OmniFaces ResetInputAjaxActionListener).

Nest it inside the command button, with a target set to the same client ID as update attribute of command button:

<p:commandButton ... update=":form">
    <p:resetInput target=":form" />
</p:commandButton>

See also:

  • How can I populate a text field using PrimeFaces AJAX after validation errors occur?
  • Reset input fields without executing validation