excelwebzone / EWZRecaptchaBundle

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

[SF5] An exception has been thrown during the rendering of a template #264

Open dadix4 opened 3 years ago

dadix4 commented 3 years ago

hello, I got an error message when I want to integrate javascript. However, I followed the documentation well. I am using symfony 5.2 and the latest version of EWZRecaptchaBundle (dev-master)

An exception has been thrown during the rendering of a template ("Warning: constant(): Couldn't find constant \EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType::RECAPTCHA_API_JS_SERVER").

<script type="text/javascript"> $(document).ready(function() { $.getScript("{{ constant('\\EWZ\\Bundle\\RecaptchaBundle\\Form\\Type\\EWZRecaptchaType::RECAPTCHA_API_JS_SERVER') }}", function() { Recaptcha.create("{{ form.recaptcha.get('public_key') }}", "recaptcha-container", { theme: "clean" }); }); }); </script>

Thanks for your help

manuxi commented 3 years ago

Seems that the constant was removed three years ago (v1.5.6) and the documentation wasn't updated accordingly. Did you manage to get it to work?