Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you code needs to be like the below, i think in the contactAction.php file the <code>public function contactAction() </code> should handle displaying the form and the action when the form has been posted to ) :</p> <p><code> //Display the form</p> <pre><code>$objForm = new Forms_ContactForm(); $this-&gt;view-&gt;form = $objForm; //Handle the form, when it has been posted including validation etc if( $this-&gt;_request-&gt;isPost() ) { if( $objForm-&gt;isValid($_POST) ) { //processing logic etc } } </code></pre> <p></code></p> <p>Currently your code is generating a new Captcha to confirm against the data input, because you are instantiating the form after the form has been POSTed to. This instantian of the form needs to be done before the form has been posted to, as I have shown in the code example above.</p> <p><strong>EDIT</strong></p> <p>Try this: <code></p> <pre><code>$captcha = new Zend_Form_Element_Captcha('captchaField', array('label' =&gt; "Please enter the 5 letters displayed below:", 'required'=&gt;true, 'captcha' =&gt; array( 'captcha' =&gt; 'image', 'font'=&gt; 'static/font/arial.ttf', 'imgDir'=&gt;'static/img/captcha', 'imgUrl'=&gt; 'static/img/captcha/', 'wordLen' =&gt; 5, 'fsize'=&gt;20, 'height'=&gt;60, 'width'=&gt;200, 'gcFreq'=&gt;50, 'expiration' =&gt; 300 ) )); $this-&gt;addElement($captcha); </code></pre> <p></code></p> <p>This new code after the edit works for me using Zend Framework version 1.11.1</p> <p>What version of Zend Framework are you sing and how is you Captcha being displayed in your view file??</p> <p>When var dumping our your output, for the captcha elment you should expect something similar to the below where "5g4ef" is the data you inputted into the Captcha input element:</p> <p><code> ["captchaField"]=> array(2) { ["id"]=> string(32) "88bb26d62e9fa19b67937c35be4a8cc7" ["input"]=> string(4) "5g4ef" } </code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload