Drupal 7.x: Ajax support / Use behaviors for 2.x

Created on 4 May 2017, over 7 years ago
Updated 5 July 2024, 3 months ago

Hi, guys.

I had a ajax link, on click I insert form in html. In this form I have reCAPTCHA field, reCAPTCHA doesn't shown in this case.

There are anonymized html:

<div class="captcha">
<input type="hidden" name="captcha_sid" value="11111">
<input type="hidden" name="captcha_token" value="11111">
<input type="hidden" name="captcha_response" value="Google no captcha">
<div class="g-recaptcha" data-sitekey="111111111111111" data-theme="light" data-type="image" data-tabindex="2"></div>
</div>

As I see in recaptcha_captcha drupal_add_html_head is used and it's not working for ajax.

I add checking if it's ajax call, and in this case use drupal_add_js instead of drupal_add_html_head, it's work for me.
Could you please check the patch.

πŸ› Bug report
Status

Needs work

Version

2.2

Component

reCAPTCHA V2

Created by

πŸ‡ΊπŸ‡¦Ukraine voron

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom JKingsnorth

    The patch in #15 does not work for me.

    In my use-case we have recaptcha set up as a fallback for recaptcha_v3.

    When we fallback to the 'I'm not a robot' checkbox, we tick the box and then we get the loading spinner in the element, but it doesn't verify us.

    The patch in #13 does work OK in our use-case.

Production build 0.71.5 2024