I am trying to implement the new Google Invisible Recaptcha and for some reason yet unknown to me the automatic html form validation and the required attributes does not seem to be working after along with the Recaptcha. I am guessing it is because of the onSubmit() function callback. Can someone let me know how to fix this issue? Thanks in advance.
Below is my implementation of a form with Google Invisible Recaptcha. The data-sitekey has been intentionally removed.
<html>
<head>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("contactForm").submit();
}
</script>
</head>
<body>
<form id="contactForm" action="#" method="POST">
<p>Leave a Message</p>
<label for="inputName">Name</label>
<input type="text" name="Name" id="inputName" placeholder="Name" required> <br>
<label for="inputEmail">Email</label>
<input type="email" name="Email" id="inputEmail" placeholder="Email Id" required> <br>
<label for="inputMessage">Message</label>
<input type="text" name="Message" id="inputMessage" placeholder="Message" required><br/>
<button class="g-recaptcha" type="submit" data-sitekey="//site-key" data-badge="bottomleft" data-callback='onSubmit'>Submit</button>
<button type="reset">Reset</button>
</form>
</body>
</html>