validation - PrimeFaces - Don't close dialog when messages appears -
how can set primefaces dialog not hide, when there "required-messages" open? @ moment, dialog closing clicking on "speichern" button, , when reopened, messages appears... let dialog open, when there unfilled required fields:
<h:panelgrid id="createnewpat" columns="3" cellpadding="1" style="margin:0 auto;"> <h:outputtext for="versnr" value="versicherten-nr.:" /> <p:inputmask id="versnr" value="#{patientenbean.versnr}" required="true"/> <p:message for="versnr" /> <p:commandbutton id="savebtn" value="speichern" action="#{patientenbean.createpatient}" oncomplete="if (!args.messageoccured) createnewpat.hide();" update="patform" /> <p:commandbutton id="resetbtn" value="reset" type="reset" /> </h:panelgrid>
if want dialog not close, commandbutton
(or component updates dialog's container) has update inside dialog. not update dialog's container, example:
<p:dialog id="dlg"> <p:panel id="pntest"> // content here <p:commandbutton update=":#{p:component('pntest')}"/> </p:panel> </p:dialog>
if not, have open dialog again in oncomplete
:
oncomplete="(args.messageoccured)? createnewpat.show(): createnewpat.hide(); "