Is it possible for $form->getMessages() to be empty yet $form->getErrors() to
contain an error?
Here's the issue, I'm validating a ReCaptcha field which is working fine in
my Zend_Form. If I forget to enter a value into the ReCaptcha field or if I
get it wrong, the error message displays in $form->getMessages(). However,
if I correctly type in the ReCaptcha image into the box, $form->getMessages
doesn't return any errors however $form->getErrors() returns "badCaptcha"
for the element.
Does this make sense? What could be wrong? I have the latest Zend version.
Just in case you want to look at the code it's below:
-- ZEND_FORM --
$publickey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$privatekey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey);
$captcha = new Zend_Form_Element_Captcha('captcha',
array(
'captcha' => 'ReCaptcha',
'captchaOptions' => array('captcha' =>
'ReCaptcha', 'service' => $recaptcha)
)
);
$this->addElement($captcha);
$this->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'custom')->setOption('lang', 'en');
$this->getElement('captcha')
->setErrorMessages(array('incorrect-captcha-sol' => 'The words you
entered did not match the image, please try again.'))
->clearDecorators();
-- FORM_VIEW --
<div class="iptblock">
<div id="recaptcha_image"></div>
<input type="text" name="recaptcha_response_field"
id="recaptcha_response_field" style="margin-top:15px;"><?php echo
$this->element->captcha; ?>
</div>
--
View this message in context:
http://n4.nabble.com/Zend-Form-odd-problem-tp1837256p1837256.html
Sent from the Zend Framework mailing list archive at Nabble.com.