A
A
Alex_872017-10-30 02:03:51
reCAPTCHA
Alex_87, 2017-10-30 02:03:51

How to put 2 or more reCAPTCHAs?

Hello! I have two questions! There are two recaptchas on the site, one in the modal window, the other at the bottom of the footer. The one in the modal is displayed! And the one that should be at the bottom, no! How to fix it?
The second issue is that the recaptcha in the modal doesn't work! After clicking on the captcha, a long download starts and an error:
59f65e420f4c5112440422.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bkosun, 2017-10-30
@bkosun

<form>
    <h1>Form 1</h1>
    <div><input type="text" name="field1" placeholder="field1"></div>
    <div><input type="text" name="field2" placeholder="field2"></div>
    <div id="RecaptchaField1"></div>
    <div><input type="submit"></div>
</form>

<form>
    <h1>Form 2</h1>
    <div><input type="text" name="field3" placeholder="field3"></div>
    <div><input type="text" name="field4" placeholder="field4"></div>
    <div id="RecaptchaField2"></div>
    <div><input type="submit"></div>
</form>

In your javascript code, you have to define a callback function for recaptcha:

<script type="text/javascript">
    var CaptchaCallback = function() {
        grecaptcha.render('RecaptchaField1', {'sitekey' : '6Lc_your_site_key'});
        grecaptcha.render('RecaptchaField2', {'sitekey' : '6Lc_your_site_key'});
    };
</script>

https://stackoverflow.com/a/28126317

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question