0

I am currently using two forms on a single page with a generated function to submit the invisible recaptcha with its token.

One of the problems is that the html5 form validation is not working anymore, it ignores the "required" tags on the input fields.

#sFormId# holds the form ID of the current form in an array.

<button id="#sFormId#submit-button" class="button small expand g-recaptcha" data-sitekey="xyz" data-callback="Submit#sFormId#" value="">submit</button>
function Submit#sFormId#(token){
  document.getElementById("#sFormId#").submit();
}

Another problem i am having is that the two forms are in seperate divs that toggle each other. The captcha badge is visible if the first form is open but once i toggle the other div to open the badge disappears with the first badge.

rrk
  • 15,677
  • 4
  • 29
  • 45
  • 1
    What you might want to do is have the captcha outside of both forms. When any form is submitted use a small javascript to include the captcha value in the post. Then process normally on the action page. – Jules May 23 '18 at 13:50
  • Possible duplicate of [HTML5 form validation before reCAPTCHA's](https://stackoverflow.com/questions/41665935/html5-form-validation-before-recaptchas) – D. Schreier Jul 04 '18 at 13:44

0 Answers0