title: facesContext is not defined Error while using facesContext.validationFailed
body: <p>I'm trying to use <code>#{facesContext.validationFailed}</code> to know whether the validation is failed or not, and to or not to showup the dialog.</p>
  
  <p>I build a tiny project to test it but get </p>
  
  <blockquote>
    <p>ReferenceError: facesContext is not defined</p>
  </blockquote>
  
  <p>in my firebug, and the dialog is never shown no matter validation is failed or not.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;h:form&gt;
          &lt;p:messages id="messages" /&gt; 
  
          &lt;h:outputLabel for="test" value="Test : *" /&gt;  
          &lt;p:inputText value="#{newBusinessCtrl.testStr}" required="true" id="test"/&gt;
          &lt;p:message for="test" /&gt;  
  
          &lt;p:commandButton value="Save" onclick="if (!facesContext.validationFailed)testDlg.show();"/&gt; 
          &lt;p:confirmDialog message="test Msg"
                           header="Success" severity="alert"            
                           widgetVar="testDlg"&gt;
              &lt;h:outputText value="input success!"/&gt;
          &lt;/p:confirmDialog&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Anyone knows why? Thanks in advance.</p>