title: Invisible Recaptcha Form Validation - Not Submitting/Ignoring Form Action
body: <p>I have a form that I'm using invisible Recaptcha on - and I want to validate a field prior to submission.  This has turned out to be a far bigger pain than anticipated, mostly due to when the ReCaptcha instance would be rendered.  But - using their docs - I've set up:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
   &lt;script&gt;
  function onSubmit(token) {
      alert("Submitting");
      document.getElementById('myform').submit();
    }
  
    function validate(event) {
      event.preventDefault();
      if (!document.getElementById('field').value) {
        alert("You must add text to the required field");
      } else {
        grecaptcha.execute();
      }
    }
  
    function onload() {
      var element = document.getElementById('submit');
      element.onclick = validate;
    }
  &lt;/script&gt;
  &lt;script src="https://www.google.com/recaptcha/api.js" async defer&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;form id="myform" action="hello.php" method="POST"&gt;
       Name: (required) &lt;input id="field" name="field"&gt;
       &lt;div id='recaptcha' class="g-recaptcha"
            data-sitekey="haoeghioaehgoiaegoiaeg2831850135"
            data-callback="onSubmit"
            data-size="invisible"&gt;&lt;/div&gt;
       &lt;button id='submit'&gt;submit&lt;/button&gt;
     &lt;/form&gt;
  &lt;script&gt;onload();&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now, it will verify that the field has been filled in, it will alert me, but it will not "submit" the action?  It stops at that point.</p>
  
  <p>What am I missing? </p>