title: How to intercept the form submission fired by JS event (in plain JS)?
body: <p>There's a <a href="https://stackoverflow.com/a/7410112/9099481">great answer here</a> on how to intercept SUBMIT using addEventListener on a form.
  It works great as long as the form is submitted either via Submit button (or ENTER).</p>
  
  <p>It's totally ignored though when fired like this:</p>
  
  <pre><code>document.getElementById('myform').submit();
  </code></pre>
  
  <p>How would you intercept such call?</p>
  
  <p>Here's the example:</p>
  
  <pre><code>&lt;script&gt;
  function checkRegistration(){
      var form_valid = (document.getElementById('some_input').value == 'google');
      if(!form_valid){
          alert('Given data is incorrect');
          return false;
      }
      return true;
  }
  &lt;/script&gt;
  
  &lt;form onsubmit="return checkRegistration()" method="get" action="http://google.com" id='myform'&gt;
      Write google to go to google..&lt;br/&gt;
      &lt;input type="text" id="some_input" value=""/&gt;
      &lt;input type="submit" value="google it"/&gt;
  &lt;/form&gt;
  &lt;a href="javascript:document.getElementById('myform').submit();"&gt;Ignore validation&lt;/a&gt;
  </code></pre>