title: Form not submitting with JS
body: <p>I have the worlds most simple javascript function:</p>
  
  <pre><code>fnSubmit()
  {
    window.print();
    document.formname.submit();
  }
  </code></pre>
  
  <p>Which is called by:</p>
  
  <pre><code>&lt;button type="button" id="submit" onclick="fnSubmit()"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>All is well and good, the print dialog shows up, however after printing or canceling the print I get the following error:</p>
  
  <p>"document.formname.submit is not a function"</p>
  
  <p>My form is defined as follows: (obviously I am not using formname in the actual code but you get the idea)</p>
  
  <pre><code>&lt;form name="formname" id="formname" method="post" action="&lt;?=$_SERVER['SCRIPT_NAME']?&gt;"&gt;
  </code></pre>
  
  <p>Obviously I am not trying to do anything special here and I have used similar approaches in the past, what in the world am I missing here?</p>