phpList.org

Include reCAPTCHA in custom subscribe page

Tags: #<Tag:0x00007f00e70eff80>
Summary

Hi, thank you so much for PHPList, absolutely awesome!

Needed to add the reCATCHA plugin to my subscription form, all good.

But how do I include it on the custom form on my website?

I added the source code below the input fields, and before selection of lists, but the ‘are you human’ just spins and does not validate.

Most appreciate any guidance on how to include Duncan’s fabulous plugin to a custom form, most appreciated.

1 Like

@Liliplanet If you view the phplist subscribe page that has recaptcha on it, there will be some html and javascript similar to this. You need to copy that into your own subscribe form

<div class="g-recaptcha" data-sitekey="xxxxx" data-size="normal" data-theme="light"></div>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=en-GB"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
    $("form[name=subscribeform]").submit(function(ev) {
        if (grecaptcha.getResponse() != "") {
            return true;
        }
        alert("Please complete the reCAPTCHA");
        return false;
    });
});
</script>

assuming that your form is named “subscribeform”.

1 Like

Oh thank you so so much Duncan, yes that works perfectly :partying_face:

Most appreciate your exceptional work :tulip:

1 Like