Details
Description
If you create a form containing a ReCaptcha captcha element it will not validate if that form is using array notation.
This form will validate correctly
class Contact_Form_Test extends Zend_Form { private static $_privKey = ''; private static $_pubKey = ''; public function init() { $this->setMethod('post'); $element = new Zend_Form_Element_Captcha('recaptcha', array( 'label' => "Please verify you're a human", 'captcha' => 'ReCaptcha', 'captchaOptions' => array( 'privKey' => self::$_privKey, 'pubKey' => self::$_pubKey, ), )); $this->addElement($element); $this->addElement('Submit', 'submit'); } }
This form will not validate and dies with a 'missingValue' error. Note the addition of $this->setElementsBelongTo('contact');
class Contact_Form_Test extends Zend_Form { private static $_privKey = ''; private static $_pubKey = ''; public function init() { $this->setElementsBelongTo('contact'); $this->setMethod('post'); $element = new Zend_Form_Element_Captcha('recaptcha', array( 'label' => "Please verify you're a human", 'captcha' => 'ReCaptcha', 'captchaOptions' => array( 'privKey' => self::$_privKey, 'pubKey' => self::$_pubKey, ), )); $this->addElement($element); $this->addElement('Submit', 'submit'); } }
Please use always the code tags!