I have a page where I generate a list of forms based on a database with PHP. I want to implement reCaptcha to prevent bots in the forms. I have two options.
To generate a reCaptcha element for each form. The problem is that I would have to generate programatically a function for each one of the forms submission, so I can use it on reCaptcha
data-callback
, something like<div class="g-recaptcha" data-sitekey="your_site_key" data-callback='submit_captcha_[formid]'></div>
where formid would be inserted through the PHP iteration.What I though is if I have the option to create a single reCaptcha element that I could share between all forms. But although I tried a lot, I couldn't get to do this. The question is: is there a form to share a submition function between forms?