So if you have been struggling with setting up decorators with ZendFormElement_Captcha, here's a note.

I used to get an additional textbox with the hash returned by Zend creating the captcha image. And if you were stumped as to how to remove them from your display try the following.

First of all your form element please note that I extracted this from my extension of the Zend_Form class

$captcha = new Zend_Form_Element_Captcha('captcha',
 array('label' => 'Type in the text you see in the image',
 'captcha' => array('captcha' => 'Image',
 'wordLen' => 6,
 'timeout' => 300,
 'height' => 60,
 'width' => 250,
 'font' => APPLICATION_PATH . '/../public/assets/fonts/arial.ttf',
 'fontSize' => 30,
 'imgDir' => APPLICATION_PATH . '/../public/assets/captcha/',
 'imgUrl' => 'http://' . $_SERVER['HTTP_HOST'] . '/assets/captcha/',
 );// there are certainly more options here but not necessary for my purposes.
//You can try altering the noise levels in the captcha image such as how many
// dots and lines should be created wiuth the image
// google noise levels in Zend_Form_Element_Captcha

This generates my captcha and I can add it to my form by going with


Bear in mind that $name and $email and $submit are also new instances of their respective Zend_Form elements. In other words don't include them if you're copying and pasting.

Now after adding your elements you have to define a separate decorator for the Captcha because it's obviously different from other form elements so here goes:

 array('Label', array('separator' => '<br />', 'requiredPrefix' => '* ')),
 array('HtmlTag', array('tag' => 'p', 'class' => 'form-element'))

Hope it's helpful