Allow multiple instances of reCAPTCHA on the same page

Created on 6 November 2012, almost 12 years ago
Updated 9 December 2023, 10 months ago

One of the problems that some developers have is trying to load reCaptcha on multiple forms on the same page. This is specifically useful when you have multiple user registration forms. I had this problem and had to solve it. I found that I really like this reCaptcha module, but it didn't allow for what I am trying to do.

So after a few days of work I have come up with an integrated solution. It can probably be modified to be specific to the forms in question, but I didn't have a need for that at this point. So I didn't go that far. But this should integrate well into the module with a little bit of dev work. I have included the patch file set against dev and some sample files to help show exactly what you need to do.

To the maintainers, please include this or something similar into the codebase so that others can use it and so that it can stay with the module through updates. If you would like any help with this please let me know. Thanks!

Sample code has been included to demonstrate this in action. Notice that in order for this to work you need a button or JS event that switches between the forms and, using that same action, allows a fresh reCaptcha instance to be loaded into the desired form.

To know more about how to do this, please refer to the sample files:
sample_multiform_loading.php
sample_multiform_loading.js

πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

reCAPTCHA V2

Created by

πŸ‡ΊπŸ‡ΈUnited States pthurmond Overland Park, KS

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.

Production build 0.71.5 2024