问题描述
我有一个表单,其中包含用户名和密码等...如果输入错误的值,验证将失败.接下来,如果我看到形式na表示先前给定的值正在输入字段中..我也清除了bean值.但尚未清除输入字段.
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
这是有效的,但问题是这仅在<rich:datatable>
第一页中有效.如果我已导航到第二页和下一页,并且所有弹出"面板本身都未打开.
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.
我正在使用jsf 2.0版,请提供一个好的解决方案.谢谢,
i am using the jsf version 2.0,Please provide a good solution.Thanks,
推荐答案
您可以将 OmniFaces库添加到您的项目中并使用他们的 ResetInputAjaxActionListener
You can add OmniFaces Library to your project and use their ResetInputAjaxActionListener
赞
<h:commandButton value="Update" action="#{bean.update}">
<f:ajax execute="@this" render="@form" />
<f:actionListener type="org.omnifaces.eventlistener.ResetInputAjaxActionListener" />
</h:commandButton>
在 BalusC 博客在Ajax更新中重置未处理的输入组件
这篇关于验证失败后无法清除输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!