excelwebzone / EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field for Symfony.
MIT License
396 stars 160 forks source link

reCaprcha loaded in ajax #15

Closed EnoahNetzach closed 10 years ago

EnoahNetzach commented 10 years ago

Currently there is no way to asynchronously add a rechapta because of the google API used (the error I get in the console is Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.), from the js file http://www.google.com/recaptcha/api/challenge (document.write('<scr'+'ipt type="text/javascript" s'+'rc="' + RecaptchaState.server + 'js/recaptcha_canary.js"></scr'+'ipt>');).

Maybe adding a form option 'ajax' and then using what is written here https://developers.google.com/recaptcha/docs/display?csw=1#AJAX (I'm not an expert in reCaptcha APIs, thou) could help?

Thanks a lot!

NV-iloweb commented 10 years ago

Any plan to solve this issue ?

OwlyCode commented 10 years ago

:+1:

reypm commented 10 years ago

@EnoahNetzach, @NV-iloweb , @OwlyCode I'm trying to add support for this feature by myself but will need some help at Symfony level, tough, since I'm getting this error all the time:

The parameter "es" must be defined.

I forked this repo to work on this feature, will any of yours be interested on help?

EnoahNetzach commented 10 years ago

I have a working version, asap I'll PR it.

EnoahNetzach commented 10 years ago

https://github.com/excelwebzone/EWZRecaptchaBundle/pull/23

excelwebzone commented 10 years ago

Merged

reypm commented 10 years ago

@EnoahNetzach @excelwebzone thanks both of yours

reypm commented 10 years ago

@EnoahNetzach any clue where to activate the AJAX support? I tried in config.yml at EWZ options without success and tried in form too with this code:

->add('captcha', 'ewz_recaptcha', array(
    'attr' => array(
        'options' => array(
            'theme' => 'clean',
            'ajax' => true
        )
    ),
    'mapped' => false,
    'constraints' => array(
        new True()
    )
))

But this doesn't work, any advice?

excelwebzone commented 10 years ago

You need to define "ewz_recaptcha_ajax" not in the form field, but in the config.yml..

excelwebzone commented 10 years ago

I updated the README with Ajax info

reypm commented 10 years ago

@excelwebzone, @EnoahNetzach Still not working for me I reported in a issue here can any of yours take a look and tell me if I'm doing something wrong?