title: Submit a form in a popup, and then close the popup
body: <p>This seemed so trivial when I started off with it! My objective is this: </p>
  
  <ul>
  <li>When user clicks on a button, open up a form in a new window.</li>
  <li>Once the form is submitted, close the popup and return to the original page. The reverse order is fine too - i.e., I am okay if the popup is closed and then the form submits.</li>
  </ul>
  
  <p>Here's how I'm doing this:</p>
  
  <pre><code>&lt;form action="/system/wpacert" method="post" enctype="multipart/form-data" onsubmit="return closeSelf()" name="certform"&gt;
                  &lt;div&gt;Certificate 1: &lt;input type="file" name="cert1"/&gt;&lt;/div&gt;
                  &lt;div&gt;Certificate 2: &lt;input type="file" name="cert2"/&gt;&lt;/div&gt;
                  &lt;div&gt;Certificate 3: &lt;input type="file" name="cert3"/&gt;&lt;/div&gt;
  
                  &lt;div&gt;&lt;input type="submit" value="Upload"/&gt;&lt;/div&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>and the Javascript looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function closeSelf(){
      self.close();
      return true;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>This seems to work fine on IE8 and Chrome; but Firefox refuses to submit the form; it just closes the popup. What might I be doing wrong?</p>
  
  <h2>EDIT:</h2>
  
  <p>Had forgotten to post the code the opens the popup. Here it is:</p>
  
  <pre><code>&lt;div&gt;&lt;input type="submit" value="Upload Certificates" onclick="popupUploadForm()"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the corresponding javascript:</p>
  
  <pre><code>function popupUploadForm(){
          var newWindow = window.open('/cert.html', 'name', 'height=500,width=600');
      }
  </code></pre>