user1216129
user1216129

Reputation: 41

Input fields not clearing after the validation fails

I have a form, it contains username and password etc... if i gave any wrong value the validation will fail. next if i see the form na that previously given values are coming in the input fields.. i cleared the bean values also. but the input fields are not yet cleared.

i have cleared the input fields using the following link 1st step.

https://cwiki.apache.org/MYFACES/clear-input-components.html

this is working but what the problem is this is working only in <rich:datatable> 1st page. if i have navigate to second page and next pages and all that Popup panel itself not opening.

i am using the jsf version 2.0, Please provide a good solution. Thanks,

Upvotes: 0

Views: 1632

Answers (2)

Daniel
Daniel

Reputation: 37051

You can add OmniFaces Library to your project and use their ResetInputAjaxActionListener

Like this

<h:commandButton value="Update" action="#{bean.update}">
    <f:ajax execute="@this" render="@form" />
    <f:actionListener type="org.omnifaces.eventlistener.ResetInputAjaxActionListener" />
</h:commandButton>

Read more about it on BalusC blog Reset non-processed input components on ajax update

Upvotes: 2

Narayan Subedi
Narayan Subedi

Reputation: 1343

Are you using session scope ? Change it to request scope. Otherwise, add your xhtml page and bean class.

Upvotes: 0

Related Questions