验证失败后无法清除输入字段 [英] Input fields not clearing after the validation fails

查看:40
本文介绍了验证失败后无法清除输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,其中包含用户名和密码等...如果输入错误的值,验证将失败.接下来,如果我看到形式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 博客 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆