and then again, it only works, if the captcha field is totally empty... if I enter the wrong words I get : Captcha value is wrong: incorrect-captcha-sol
and that's what I don't want! has anyone done that? -----Ursprüngliche Nachricht----- Von: Markus Hausammann [mailto:[email protected]] Gesendet: Donnerstag, 18. Dezember 2008 21:55 An: 'Markus Hausammann' Betreff: AW: [fw-general] setOptions in reCaptcha form element here my own answer to the whole reCaptcha problem: as the form element implements the adapter as validator, it's possible to get the Validator by adapter name like that: $captcha = new Zend_Form_Element_Captcha('challenge', array( 'captcha' => 'ReCaptcha', 'label' => 'Um zu beweisen, dass Sie kein Computer sind, geben Sie bitte die zwei angezeigten Wörter ein.', 'captchaOptions' => array( 'captcha' => 'ReCaptcha', 'privKey' => $config->recaptcha->private, 'pubKey' => $config->recaptcha->public) )); $captcha = $this->addElement($captcha); $this->getElement('challenge')->getCaptcha()->getService() ->setOption('theme', 'clean') ->setOption('lang', 'de'); $captcha = $this->getElement('challenge')->getValidator('ReCaptcha')->setMessage('test' ); -----Ursprüngliche Nachricht----- Von: Markus Hausammann [mailto:[email protected]] Gesendet: Donnerstag, 18. Dezember 2008 21:08 An: [email protected] Betreff: AW: [fw-general] setOptions in reCaptcha form element follow up question: How can I add a custom error message to the Captcha Element? In order to change the validator message I have to getValidator() but in this case I didn't define any... so how can I change the message? Thanks! -----Ursprüngliche Nachricht----- Von: Mike Rötgers [mailto:[email protected]] Gesendet: Donnerstag, 18. Dezember 2008 19:23 An: [email protected] Betreff: Re: [fw-general] setOptions in reCaptcha form element I had the same problem. Maybe there is a more elegant way ... however, this works for me: $form->getElement('captcha')->getCaptcha()->getService()->setOption('theme', 'clean')->setOption('lang', 'de'); Kind regards Mike Markus Hausammann schrieb: > Hi > I'm implementing recaptcha but I would like to change the theme and the > language. > > Here is how I create the form element: > > $captcha = new Zend_Form_Element_Captcha('challenge', array( > 'captcha' => 'ReCaptcha', > 'captchaOptions' => array( > 'captcha' => 'ReCaptcha', > 'privKey' => $config->recaptcha->private, > 'pubKey' => $config->recaptcha->public) > )); > > now I would like to pass the options to the service: array('theme' => > 'clean', 'lang' => 'de') > > I tried several ways but couldn't make it work. How can I access the adapter > and pass the options? > I know there is a method setOptions() for the service but how can I get the > service if I have instantiated the form element? > > Thanks!! > Markus > >
