SOLVED :) I have spend a bit more time on http://recaptcha.net/apidocs/captcha/client.html
And found the way as explained here: http://www.symfony-project.org/forum/index.php/m/40626/ Originally I have used sfWidgetFormReCaptcha from the sfFormExtraPlugin, so here is overridden render(...) method: /** * @see sfWidgetForm */ public function render($name, $value = null, $attributes = array(), $errors = array()) { $server = $this->getServerUrl(); $key = $this->getOption('public_key'); return sprintf(' <div id="recaptcha_div"></div> <script type="text/javascript"> Recaptcha.create("%s", "recaptcha_div", { theme: "red", callback: Recaptcha.focus_response_field }); </script> <noscript> <iframe src="%s/noscript?k=%s" height="300" width="500" frameborder="0"></iframe><br /> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> </noscript> ', $key, $server, $key); } !!! We also need api script included, it's might be template of the current form, for example: <?php use_javascript('http://api.recaptcha.net/js/recaptcha_ajax.js') ?> p.s. NOTE: for the forms initially loaded thru ajax we need to make sure the page already have: <script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> On Fri, 2008-12-26 at 02:35 +0200, Yevgeniy A. Viktorov wrote: > Hello, > > Thanks for your interest :) > > I am using Ajax.Updater of prototypejs lib to add ajax interaction to > regular form, something like this: > 'onsubmit="new Ajax.Updater(this.parentNode ...' > > The original form already contain reCaptcha widget which works fine in > regular/classic workflow, but when I am trying to interact thru ajax > it's loosing the '<script src="http://..."></script>' part from output. > > Here is forum thread about similar problem: > http://www.symfony-project.org/forum/index.php/m/40626/ > > But in my case I can't include script in other place: > '<script type="text/javascript" > src="http://api.recaptcha.net/challenge?k=XXXXXXXXX"></script>' > > > Seems like NOT symfony related problem with dynamic loading of > external JavaScript files... > > > On Thu, 2008-12-25 at 20:17 +0000, Lee Bolding wrote: > > Can you explain your problem a little better? > > > > I'm using reCaptcha with an AJAX form on http://lastminute.visualdna.com > > > > I can't remember having any weird headaches other than having to > > bypass the new forms stuff and manually instantiating the > > reCaptureValidator in my action. > > > > If you use reCaptcha with AJAX, don't forget to reload the captcha on > > a failed attempt > > > > On 25 Dec 2008, at 07:55, Yevgeniy A. Viktorov wrote: > > > > > > > > Hello, > > > > > > > > > I have tried to build simple ajax form with reCaptcha, but got some > > > problems. The response of submitted form does not contain any > > > '<script></script>' tags. And it's not just reCaptcha, any others > > > custom > > > 'script' tags omitted from ajax response. > > > > > > Seems like it's makes security sense, but I am looking for the right > > > solution... > > > > > > > > > Thanks for any help. > > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
