title: javascript async await Submitting a form with onsubmit using Promise
body: <p>I'm having following code.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script type="text/javascript"&gt;
        function sleep( lf_ms ) {
          return new Promise( resolve =&gt; setTimeout( resolve, lf_ms ) );
        }
  
        async function check_form() {
          alert( 'Test 1' );
          await sleep( 1000 );
          alert( 'Test 2' );
  
          return false;
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form name="myform" method="post" action="test.htm" onsubmit="return check_form();"&gt;
        &lt;input type="text" name="city"&gt;&lt;br&gt;
        &lt;br&gt;
        &lt;a href="javascript:check_form();"&gt;check the method call via link&lt;/a&gt;&lt;br&gt;
        &lt;br&gt;
        &lt;button type="submit"&gt;check the method call via submit button&lt;/button&gt;&lt;br&gt;
        &lt;br&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to sleep the function check_form() for 1 second.</p>
  
  <p>If I click on the link, "Test 1" and "Test 2" will be displayed. If I click the submit button only "Test 1" is displayed. What am I doing wrong here?</p>
  
  <p>My question is different from <a href="https://stackoverflow.com/questions/50360642/submitting-a-form-with-submit-using-promise">Submitting a form with submit() using Promise</a>. Because the javascript event handler onsubmit is not used. </p>