清除Hibernate验证器消息 [英] Clear Hibernate validator messages

查看:201
本文介绍了清除Hibernate验证器消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面(一个弹出窗口)和一些文件。当我在此页上提交表单时,会触发验证并显示错误。

I have a page (a popup) with some fileds. When I submit the form on this page, the validation is triggered and the errors appear.

问题是,如果我关闭弹出窗口并重新打开它,错误消息仍然在该页面上。弹出窗口重新打开时如何清除验证?

The problem is that, if I close the popup and reopen it, the error messages are still on that page. How can I clear the validations when the popup is reopened?

该页面由JSF制作。

谢谢!

Thanks!

推荐答案

让ajax在打开它之前更新弹出窗口。

Let ajax update the popup before you open it.

目前还不清楚您使用的是哪个组件库popup,但假设它是PrimeFaces,它应该看起来像这样:
$ b

It's unclear what component libary you're using for the popup, but assuming that it's PrimeFaces, it should look like this:

<h:form>
    ....
    <p:commandButton ... update=":dialog:form" oncomplete="dialog.open()" />
</h:form>

<p:dialog id="dialog" widgetVar="dialog" visible="false" ...>
    <h:form id="form">
        <p:messages />
        ...
        <p:commandButton ... oncomplete="if (!args.validationFailed) dialog.hide()" />
    </h:form>
</p:dialog>

这篇关于清除Hibernate验证器消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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