title: Error submitting form via JavaScript (.submit())
body: <p>I have the following modal window on my page:</p>
  <pre><code>&lt;!-- Modal --&gt;
  &lt;div class=&quot;modal fade&quot; id=&quot;BillsReceive&quot; tabindex=&quot;-1&quot; aria-labelledby=&quot;exampleModalLabel&quot; aria-hidden=&quot;true&quot;&gt;
    &lt;div class=&quot;modal-dialog modal-fullscreen&quot;&gt;
      &lt;div class=&quot;modal-content &quot;&gt;
        &lt;div class=&quot;modal-header&quot;&gt;
          &lt;h5 class=&quot;modal-title&quot; id=&quot;exampleModalLabel&quot;&gt;Register new product&lt;/h5&gt;
          &lt;button type=&quot;button&quot; class=&quot;btn-close&quot; data-bs-dismiss=&quot;modal&quot; aria-label=&quot;Close&quot;&gt;&lt;/button&gt;
        &lt;/div&gt;
        &lt;div class=&quot;modal-body&quot;&gt;
          &lt;?php 
          
          include 'BillsReceive.php';
          
          ?&gt;
        &lt;/div&gt;
        &lt;div class=&quot;modal-footer&quot;&gt;
          &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-bs-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
           &lt;button id=&quot;submit-add-article-form&quot; title=&quot;New Register&quot; class=&quot;btn btn-success&quot; onclick=&quot;fncSendForm();&quot;&gt; &lt;i class=&quot;fa fa-plus&quot;&gt;  &lt;/i&gt;Save Changes&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>The modal window has an include that contains a page with a &quot;registration form&quot; of accounts receivable. The form on the &quot;BillsReceive.php&quot; page is below:</p>
  <pre><code>&lt;form action=&quot;../I_MVC/Controller/Registrations/InsertBillsReceive.php&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; id=&quot;BillsReceive&quot; name=&quot;BillsReceive&quot; &gt;
  &lt;div class=&quot;container&quot;&gt;
  
  &lt;br/&gt;
  
     &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; Code:&lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; &lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Default input&quot; aria-label=&quot;default input example&quot; name=&quot;Code&quot;&gt; &lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
     &lt;/div&gt;
     
  &lt;br/&gt;
  
   &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; Usual Name:&lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; &lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Default input&quot; aria-label=&quot;default input example&quot; name=&quot;UsualName&quot;&gt; &lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
     &lt;/div&gt;
     
  &lt;br/&gt;
     
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; Type:&lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10 col-xxl-10&quot;&gt; &lt;input class=&quot;form-control&quot; type=&quot;text&quot; placeholder=&quot;Default input&quot; aria-label=&quot;default input example&quot; name=&quot;Type&quot;&gt; &lt;/div&gt;
      &lt;div class=&quot;col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1 col-xxl-1&quot;&gt;&lt;/div&gt;
     &lt;/div&gt;
     
   &lt;br/&gt;
  
  &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  <p>Well then, the &quot;Save Changes&quot; button of the modal window calls a JavaScript function to send the page's form. Below is the javascript function that should submit the form:</p>
  <pre><code>function fncSendForm()
  
  {
      
      document.getElementById(&quot;BillsReceive&quot;).submit();
      
  }
  </code></pre>
  <p>But when calling the function in javascript, the following error occurs:</p>
  <blockquote>
  <p>Uncaught TypeError: document.getElementById(...).submit is not a
  function</p>
  <pre><code>at fncSendForm (VM34 InsertBillsReceive.js:10)
  at HTMLButtonElement.onclick (VM41 ShowBills.php:1113) fncSendForm @ InsertBillsReceive.js:10 onclick @ VM41 ShowBills.php:1113
  </code></pre>
  </blockquote>
  <p>Why is the submit function not submitting the form? The function is correct and the file is linked in the modal window page. Why didn't the function work?</p>