Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces how to erase validation fails in dialog when reopen the dialog

I have a required input field in a p:dialog. If firstly I submit nothing for the field, a validation error happens on that field. Then I close the dialog and reopen it, the validation error still exists. What can I do to eliminate the validation error when close the dialog?

like image 930
ethanjyx Avatar asked Aug 06 '13 21:08

ethanjyx


1 Answers

You should use the p:resetInput on the element that you have to open the dialog.

For example if you use a p:commandButton

<p:commandButton value="Open dialog" update=":dialogId" oncomplete="PF('dialogWidget').show()" >
    <p:resetInput target=":dialogId" />
</p:commandButton>

This will reset the cached values (including the validation messages) upon opening the dialog.

like image 51
jansohn Avatar answered Sep 20 '22 05:09

jansohn