Show dialog when the input data is validated <p:confirmDialog> <p>For my school project I have to realize a mini website where I use primefaces framework. In a form I want after pressing the Save button two things: 1 - Validate the data entered. that's why I put</p> <pre><code>&lt;p:message for="date" /&gt; and &lt;p:message for="zone" /&gt; </code></pre> <p>As the values ​​are not correct, the dialog box should not be displayed. 2 - When all data is correct, and I click Save, I want to display my dialog box.</p> <p>Now I can not. Can you help me? I use version 4 primefaces.</p> <pre><code>&lt;h:form&gt; &lt;p:panel id="panel" header="Create" style="margin-bottom:10px;border-color:blueviolet" &gt; &lt;p:messages id="messages" /&gt; &lt;h:panelGrid columns="3"&gt; &lt;h:outputLabel for="date" value="Date : *" /&gt; &lt;p:calendar locale="fr" id="date" value="#{newBusinessCtrl.exercice.debut}" required="true" label="date" showButtonPanel="true"/&gt; &lt;p:message for="date" /&gt; &lt;h:outputLabel for="zone" value="Zone Monétaire: *" /&gt; &lt;p:selectOneMenu id="zone" value="#{newBusinessCtrl.exercice.zoneChoice}" &gt; &lt;f:selectItem itemLabel="Choice " itemValue="" /&gt; &lt;f:selectItems value="#{newBusinessCtrl.exercice.zones}" var="azone" itemLabel="#{azone}" itemValue="#{azone}" &gt; &lt;/f:selectItems&gt; &lt;p:message for="zone" /&gt; &lt;/p:selectOneMenu&gt; &lt;p:message for="zone" /&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;p:commandButton update="panel" value="Save" icon="ui-icon-check" style="color:blueviolet" onclick="choice.show()"/&gt; &lt;p:confirmDialog message="Would you like to create accounts automatically ?" header="Account creation" severity="alert" widgetVar="choice" appendTo="@(body)"&gt; &lt;p:button outcome="personalizeAccount" value="Personalize" icon="ui-icon-star" /&gt; &lt;p:button outcome="autoAccount" value="Continue" icon="ui-icon-star" /&gt; &lt;/p:confirmDialog&gt; </code></pre> <p></p>