Reputation: 71
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?
The page is made with JSF.
Thanks!
Upvotes: 1
Views: 271
Reputation: 1109570
Let ajax update the popup before you open it.
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>
Upvotes: 1