Recaptcha v3 on multipage forms

How to fix reCAPTCHA v3 causing form submission to hang on multipage forms.

Overview

The issue occurs when the submit button has an ID of "submit", which conflicts with the JavaScript form.submit() function.
Change the ID of the submit button to a different value, such as "submitBtn", to resolve the conflict and allow the form to submit correctly.

Answered
ChronoForms v8
sz szablac 28 Aug, 2025

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.

Max_admin Max_admin 28 Aug, 2025
Answer

Keep captcha to first page only, does this fix it?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
sz szablac 28 Aug, 2025

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?

Max_admin Max_admin 29 Aug, 2025

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

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin Max_admin 29 Aug, 2025

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

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
sz szablac 31 Aug, 2025
1 Likes

Thank you for your help, I will follow this advice.

sz szablac 26d ago

I found the root cause and the real solution.

TLDR: do not use the word "submit" as id of the submit button

I created a new form that had only one page and I experienced the same mulfunction: when I submit the form, it keeps loading, spins forever and nothing happens. So I realized the issue was not because my form had multiple pages. As the browser's console revealed that it was a javascript issue and I knew that ReCaptcha v3 worked perfectly in other cases, I concluded that there was some incompatibility between the settings (of the fields) of my form and ReCaptcha. The error message in the console helped: form.submit is not a function. Why is it not a function? It should be, it is common javascript function. The answer: the word "submit" is used for another purpose. And yes, it was the id of my submit button. (What is quite natural to name it that way.) I changed the id of the submit button and everything works perfectly.And it works perfectly on single page forms and on multipage forms as well.

Post a Reply