Hi,
I have a form that consists of 3 pages. On submission of each page I have log data and save data actions, therefore I would like to apply Recaptcha v3 on each pages.
I can submit the first page. When I submit the second page, it keeps loading, nothing happens. In console, I can see an error message: TypeError: form.submit is not a function
The issue is in this part of the javascript code:
if (this._element.querySelector(".g-recaptcha.v3")) {
e.preventDefault();
let form = this._element;
grecaptcha.ready((function() {
grecaptcha.execute(form.querySelector(".g-recaptcha.v3").getAttribute("data-sitekey3"), {
action: "submit"
}).then((function(token) {
form.querySelector(".g-recaptcha.v3").remove(),
form.querySelector('[name="g-recaptcha-response"]').value = token,
form.submit()
}
))
}
))
}
Could you help, please?
Thanks in advance.
Keep captcha to first page only, does this fix it?
Yes. If it is only on the first page, it works. But does this method secures data submission of the second and third pages as well?
Users can not access later pages without accessing the first page (assuming the pages have the same Page Group value, which is the default).
So if the first page is secured then you should be ok
This also applies to the Log Data and Save Data actions, unless you need to make sure each step is saved in case the user quits early, it's better to save one time at the last page Submit event