title: Javascript form.submit() not working in Firefox
body: <p>There are several questions/answers on this <a href="https://stackoverflow.com/questions/7117084/jquery-form-submit-on-chrome-works-but-not-in-firefox">here</a>, <a href="https://stackoverflow.com/questions/22555533/form-submit-not-working-in-firefox">here</a> and <a href="https://stackoverflow.com/questions/18087721/jquery-submit-not-working-for-firefox">here</a> and elsewhere, but they all seem JQuery specific and do not appear to apply to this (for example, I am <strong>NOT</strong> creating a new Form object, this is an existing form in the document.   Also I am <strong>NOT</strong> using Jquery at all).</p>
  
  <p>I have a form which has to be modified before submission for reasons of IE7 compatibility.   I have to strip out all the <code>BUTTON</code> tags from my form and then add a hidden field, but this is all in an existing form on the existing HTML page.    This code works properly in IE and Chrome but doesn't work in Firefox (versions 23 &amp; 24 both tested).</p>
  
  <pre><code>    buttonClickFunction(formName, buttonObject) {
          var formObject = document.forms[formName];
          var i = 0;
  
          // Strip out BUTTON objects
          for (i=0;i&lt;formObject.length;i++) {
              if (formObject[i].tagName === 'BUTTON') {
                  formObject[i].parentNode.removeChild(formObject[i]);
                  i--;
              }
          }
  
          // Create new field
          var newField = document.createElement('input');
          newField.type = 'hidden';
          newField.id=buttonObject.id;
          newField.name = buttonObject.name;
          if (buttonObject.attributes['value'] != null) {
              newField.value = buttonObject.attributes['value'].value;
          } else {
              newField.value = buttonObject.value;
          }
  
          // Submit form
          formObject.appendChild(newField);
          document.forms[formName].appendChild(newField);
          document.forms[formName].submit();
      }
  </code></pre>
  
  <p>In addition to the <code>document.forms[formName].submit()</code>  I have also tried <code>formObject.submit()</code>  - both work in Chrome but both fail in Firefox.   I'm at a loss as to why this doesn't work - I've traced through the JS and watched that <code>document.forms[formName].submit()</code> execute - no exception appears but nothing goes to the server.  </p>
  
  <p>Can anyone identify why Firefox won't submit this form, and how I can fix it?</p>