• Resolved Manuel

    (@marowi)


    Hello,

    in my Elementor contact forms I always have a acceptance checkbox for reading the privacy policy and the use of reCAPTCHA. reCAPTCHA is blocked until the checkbox is checked.

    It looks like this: https://ibb.co/rZpS0Xc

    I made this by adding an HTML element to the Elementor form with the following content:

    <script>
        document.getElementById("form-field-field_fb25243").classList.add("cc-accept-all");
    </script>

    This worked like charme, until the release of Complianz 6.

    I already read your update manual over here https://complianz.io/update-manual-for-complianz-6-0/ and found out that some CSS classes have changed.

    So I tried the new CSS class in my JS code:

    <script>
        document.getElementById("form-field-field_fb25243").classList.add("cmplz-accept");
    </script>

    But this does not work completely. If I now click the checkbox, reCAPTCHA is loaded but the checkmark is not set. And this is why the whole contact form does not work. Because the checkbox is a required field and cannot be checked anymore.

    I already tried other classes that I found in your integration guides, like “cmplz-accept cmplz-elementor” or “cmplz-accept-marketing cmplz-elementor”. Nothing really works. reCAPTCHA is loaded but the checkmark cannot set.

    Could you please tell me how to get the checkbox work again? I am not really a fan of your button solution, which disappears after you click it.

    Many thanks and best regards!

    Manuel

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    As the click event in complianz includes a preventDefault statement, I think that prevents the checkbox from getting selected.
    This should handle that:

    document.addEventListener('click', e => {
        let checkbox = document.getElementById("form-field-field_fb25243");
        if ( checkbox && e.target.closest('.cmplz-accept') ) {
            checkbox.checked=true;
        }
    });
    Thread Starter Manuel

    (@marowi)

    Hi Rogier,

    many thanks for your help.

    With your code no “cmplz-accept” class is added to the checkbox, right? I have tried your code and the checkbox works then, but no reCAPTCHA is loaded. I think this is because of the missing Complianz class.

    I also tried both codes together and then the “cmplz-accept” class is added and reCAPTCHA is loaded again, but the checkmark is not set.

    Best regards
    Manuel

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @marowi I’ve just checked the code and I see what you mean. I realised cmplz-accept class is now handled differently, so this needs to be handled in another way.

    This code is tested, and works (the cmplz_set_banner_status is not needed if you’re not actually showing the complianz banner):

    document.addEventListener('click', e => {
        if ( e.target.closest('#form-field-field_fb25243') ) {
           cmplz_accept_all();
           cmplz_set_banner_status('dismissed');
        }
    });
    Thread Starter Manuel

    (@marowi)

    With this code, it works again! ??

    Thank you very much.
    Manuel

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Elementor and Complianz custom accept cookies link not working anymore’ is closed to new replies.