My quesiton is when I add onclick="dlg2.hide()" to a commandbutton then I can see required fields warnings outside the dialog but if I remove onclick="dlg2.hide()" then I can see the warnings inside the dialog
What I would like to do is see the required fields warnings inside the dialog if some fields are empty then if there is no empty field hide the dialog page.
How can I do that ?
required fields and dialog hiding
Hi burakh79
in my sample application i used oncomplete instead of onclick
here a short example:
in my sample application i used oncomplete instead of onclick
here a short example:
Code: Select all
<p:dialog id="addProvPopup" widgetVar="addProvDlg" resizable="false" modal="true"
closable="false" closeOnEscape="false"
appendTo="@(body)" showEffect="fade" hideEffect="fade" >
<f:facet name="header">
<h:outputText value="#{msgs.add}:  " />
</f:facet>
<h:form id="addProvForm">
<h:panelGrid id="addProvGrid" columns="3" cellpadding="5">
<p:outputLabel id="addProvReportnumberLabel" value="#{msgs.provReportnumber}: "
for="addProvReportnumber" />
<p:inputText id="addProvReportnumber"
value="#{provisionModel.provReportnumber}"
required="true" requiredMessage="#{msgs.requiredMsg}"
validatorMessage="#{msgs.reportnumberMsg}" >
<f:validateLength minimum="8" maximum="9" />
</p:inputText>
<p:message id="addProvReportnumberMsg" for="addProvReportnumber" />
</h:panelGrid>
<p:commandButton
value="#{msgs.close}" immediate="true"
oncomplete="PF('addProvDlg').hide(); return false;"
action="#{propertyModel.reset()}" update="addProvGrid" />
<p:commandButton id="addProvSaveButton" style="float:right"
value="#{msgs.save}"
action="#{provisionCtr.addProv()}"
oncomplete="if (args && !args.validationFailed) PF('addProvDlg').hide()"
update="addProvForm"
process="@form"
/>
</h:form>
</p:dialog>
Lars
______________________________
PrimeFaces 5.3 | Tomcat 8.0.30 | MyFaces 2.2.0
Firefox 44.0.2
______________________________
PrimeFaces 5.3 | Tomcat 8.0.30 | MyFaces 2.2.0
Firefox 44.0.2
-
- Information
-
Who is online
Users browsing this forum: No registered users and 23 guests