title: Force error message to Zend Form Element
body: <pre><code>    // Process the forms
      if (($this-&gt;getRequest()-&gt;isPost())
              &amp;&amp; ($this-&gt;getRequest()-&gt;isXmlHttpRequest())) {
  
          // Initiate response
          $status = false;
          $msg = '';
          $zf = null;
  
          // Error test
          $form-&gt;getElement('no')-&gt;addError('This is the error message');            
  
          if ($form-&gt;isValid($this-&gt;getRequest()-&gt;getPost())) {
  
          // Everything is good
              $status = true;
  
          } else {
  
          // Get the error messages
              $zf = $form-&gt;getMessages();
          }
  
          // Setup the response
          $result = json_encode(array('status' =&gt; $status,
                                      'msg' =&gt; $msg,
                                      'zf' =&gt; $zf));
  
          $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender();
          $this-&gt;_helper-&gt;layout()-&gt;disableLayout();
  
          $this-&gt;getResponse()-&gt;setHeader('Content-Type', 'application/json');
          $this-&gt;getResponse()-&gt;setBody($result);
  
          return;
  
      } else {
          // Populate the form
      }
  </code></pre>
  
  <p>As you can see, I've used <code>$form-&gt;getElement('no')-&gt;addError('This is the error message');</code> to force error on the form element, but <code>$form-&gt;getMessages();</code> would still return <code>NULL</code>. So, what should I do to force error on the selected form element?</p>