Closed reypm closed 7 years ago
You are right. The bundle does not handle reCaptcha loading by js (so by definition, ajax too). I made a pull request to fix this bug.
You can use this genemu_recaptcha_javascript
block in a custom template form file until the pull request will be merge.
{% block genemu_recaptcha_javascript %}
{% spaceless %}
<script type="text/javascript" src="{{ asset("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js") }}"></script>
<script type="text/javascript">
function genemu_recaptcha_load()
{
Recaptcha.create('{{ public_key }}', '{{ id }}_div', {{ configs|json_encode|raw }});
}
if (window.addEventListener) {
window.addEventListener('load', genemu_recaptcha_load, false);
} else if (window.attachEvent) {
window.attachEvent('onload', genemu_recaptcha_load);
} else {
window.onload = genemu_recaptcha_load;
}
</script>
{% endspaceless %}
{% endblock genemu_recaptcha_javascript %}
Sorry for my ignorance, that code give me an error Variable "public_key" does not exist in blablabla.html.twig in line where this is Recaptcha.create('{{ public_key }}', '{{ id }}_div', {{ configs|json_encode|raw }});
how can I fix that?
I'm just wondering, since I didn't see nothing at config level, if this bundle supports for display reCAPTCHA from AJAX API as explained here if it's supported any example around configuration to take care?