excelwebzone / EWZRecaptchaBundle

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

EWZRecaptchaType::RECAPTCHA_API_JS_SERVER does not exist #276

Open hai-van-silkwires opened 2 years ago

hai-van-silkwires commented 2 years ago

Hi team,

I used above block code, it's seem EWZRecaptchaType::RECAPTCHA_API_JS_SERVER doesn't exist.

<div id="recaptcha-container"></div>
<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>
nhung-le commented 1 year ago

hello is there any solution for this yet? I also got

Undefined constant EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType::RECAPTCHA_API_JS_SERVER

Please update constant in your code, currently my temp solution is:

$.getScript("https://www.google.com/recaptcha/api.js", function() {
            Recaptcha.create("mykey, "recaptcha-container", {
                theme: "clean"
            });
        });