Reputation: 9477
We use JSF / Primefaces in our web application and have trouble in clearing the form fields.
If use the type=reset it clears the text fields but not the drop-downs.
<p:commandButton type="reset" ... />
So I tried to change type="submit" and manually cleared all fields in the action. However as the page has mandatory fields it expect values for them, So I tried immediate="true" But due to JSF life cycle this combination update="@form" immediate="true" clashes...
<p:commandButton type="submit" update="@form" immediate="true" ... />
Does JSF has any other way to do this simple clear form fields ?
Upvotes: 1
Views: 950
Reputation: 4345
I don't know if its simplest, but could you try
<p:commandButton process="@this" update="@form" actionListener="#{bean.resetMethod()}" />
Upvotes: 1