evoWeb / recaptcha

TYPO3 Extension to make use of googles nocaptcha
GNU General Public License v2.0
5 stars 18 forks source link

Forms stop working when two forms are on the same page #86

Closed schugabe closed 1 month ago

schugabe commented 2 months ago

In the Version for TYPO3 11 it was fine to put two forms with invisible recaptcha on the same page. This stopped working with v12.

The second form works normal but the first does not. The field and response in this class https://github.com/evoWeb/recaptcha/blob/develop/Resources/Public/JavaScript/Frontend/form.js are empty and the form is not submitted. The global window.onRecaptchaSubmit is set for each form so only the last one wins.

garbast commented 1 month ago

That is right, there needs to be a global callback which gets triggered by recaptcha after resolving. So there is not much i can do there. If you have an idea that fixes this, i would gladly hear about that.

liayn commented 1 month ago

Hi Sebastian,

maybe take inspiration from https://developers.google.com/recaptcha/docs/display?hl=en "Explicit rendering for multiple widgets"

My general idea would be to collect the forms in an array and let the global callbacks work on this array to find the affected form.

garbast commented 1 month ago

With version 14.0.0 this is now possible. Watch out for the breaking changes.