title: Keep <p:dialog> open when validation has failed
body: <p>I have a CRUD page which shows data from a query (a List of domain objects) in a Primefaces datatable.</p>
  
  <pre><code>&lt;p:dataTable 
                  id="negozi" 
                  var="n" 
                  value="#{nController.theListFromQuery}" 
                  rowKey="#{n.id}"
                  selection="#{nController.selected}" 
                  selectionMode="single"&gt;
  
                  &lt;p:column headerText="Field1"&gt;
                      &lt;h:outputText value="#{n.f1}" /&gt;
                  &lt;/p:column&gt;
                  &lt;p:column headerText="Field2"&gt;
                      &lt;h:outputText value="#{n.f2}" /&gt;
                  &lt;/p:column&gt;
  &lt;p:column style="width:4%"&gt;
                      &lt;p:commandButton 
                          actionListener="#{nController.prepareEdit(n)}"
                          update=":editDialogId" 
                          oncomplete="editDialog.show()" 
                          value="Edit" /&gt;
                  &lt;/p:column&gt;
  ...
  </code></pre>
  
  <p>By clicking on the edit button a dialog will be shown:</p>
  
  <pre><code>    &lt;p:dialog 
                  header="Edit N" 
                  widgetVar="editDialog" 
                  id="editDialogId"&gt;
  
                      &lt;h:form id="formDialog"&gt;
  
                          &lt;h:panelGrid id="editDialogTable" columns="2" cellpadding="10" style="margin:0 auto;"&gt;
  
                              &lt;p:outputLabel for="field1" value="F1:" /&gt;
                              &lt;p:inputText id="field1" value="#{nController.selected.f1}" /&gt;
                              &lt;p:outputLabel for="field2" value="F2:" /&gt;
                              &lt;p:inputText id="field2" value="#{nController.selected.f2}" /&gt;
  &lt;p:commandButton 
                          value="Confirm" 
                          actionListener="#{nController.doEdit}" 
                          update=":form" 
                          oncomplete="editDialog.hide()"
                          rendered="#{nController.selected.id!=null}" /&gt;                  
  ...
  </code></pre>
  
  <p>It works. Now I want to make F1 a required field.</p>
  
  <p>I add the "required" attribute to the inputText field and what happens?</p>
  
  <p>When I try to confirm the form without the required field, the entity is not edited (that's right) but the dialog is closed (that's NOT right!)</p>
  
  <p>When I reopen the dialog I can see the red highlight on the required (and invalid) field.</p>
  
  <p><strong>What I want is to prevent the dialog closing if the form is invalid.</strong></p>
  
  <p>Do I have to write some JS or will JSF help me?</p>