title: How to trigger args.validationFailed in PrimeFaces oncomplete
body: <p>When the <code>Save</code> button is pressed, the data from the <em>actionsDialog</em> should be validated. If the required information is entered and valid, a second dialog called <em>reasonDialog</em> would be displayed. </p>
  
  <p>Non-JSF validation of the saved object is done with a method that returns a list of error messages. I case the validation fails the errors messages are displayed with FacesMessage. How should I do in <code>objectsBean.validate</code> to trigger the if else clause from <code>oncomplete</code>? </p>
  
  <pre><code>&lt;p:dialog id="actionsDialog" widgetVar="actionsDialog" dynamic="true" 
      resizable="false" width="800" modal="true"&gt;
      &lt;ui:include src="/WEB-INF/flows/custom-flow/genericObject.xhtml"/&gt;
      &lt;f:facet name="footer"&gt;
          &lt;p:commandButton value="Save" update="msgs"
              oncomplete="if (args.validationFailed) {reasonDialog.hide()} else {reasonDialog.show()}"
              actionListener="#{objectsBean.validate}"/&gt;
          &lt;p:commandButton value="Cancel" immediate="true" oncomplete="actionsDialog.hide()" /&gt;
      &lt;/f:facet&gt;
  &lt;/p:dialog&gt;
  </code></pre>