I have an AMP page with a webform on. Originally, I used a recaptcha v2, but with AMP, only recaptcha v3 is available (because v2 add an additional script, and it's not accepted by AMP).

So I installed recaptcha-v3 module.

Without AMP, it work like a charm !

But with AMP, I can't submit my webform, because AMP require that form with POST method have a action-xhr attribute. But when I did it, on submit, I have the following error on my console :

[amp-form] Failed to parse response JSON: SyntaxError: Unexpected token < in JSON

I guess action-xhr wait for a JSON response, but webform return an HTML response...

I tried to add a submit action on my webform, to return a json response, but I don't access the recaptcha score...
And ideally, I would like to redirect the user after submission.

Also, I tried to use the amp-recaptcha-input tag, but it doesn't work : what name and data-action should I fill in ?

What is the right way to implements a recaptcha_v3 with webform on AMP page ?

Comments

rmafat created an issue. See original summary.

dench0’s picture

Status: Active » Closed (won't fix)
durancode’s picture

It this solved?

Removing reCaptcha isn't an option.

dench0’s picture

No, there are no plans to solve this problem.

durancode’s picture

Thanks for the answer, I had to send the url to a canonical webform