title: observe form submit response targetting an iframe
body: <p>I have an app which runs in a new window. There are several forms to generate a PDF export. When I submit one of these forms, the window loses its focus and the original window pops up again when the download appears. </p>
  
  <p>I created an iframe, so the forms can target the iframe and the current window doesn't lose its focus. It works great, but I have no idea how to observe the response inside the iframe if everything went right.</p>
  
  <p>Here is how its working so far. I'm using prototypeJS.</p>
  
  <pre><code>&lt;iframe id="pdf_frame" name="pdf_frame" style="display:none;"&gt;&lt;/iframe&gt;
  
  &lt;form id="PDF_gen" name="PDF_gen" target="pdf_frame" action="pdf.pl"&gt;
        &lt;input type="hidden" name="size" value=""&gt;
        &lt;!-- more hidden inputs --&gt;
  &lt;/form&gt;
  &lt;input type="button" id="pdf_submit" value="generate pdf"&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$('pdf_submit').observe('click', function(){
      //write stuff to hidden inputs
      $('PDF_gen').submit();
  });
  </code></pre>
  
  <p>If something goes wrong, the download dialogue does not appear. When using prototypes form.request() the browser does not know how to handle the response and does not bring up the download dialogue. How can I do it right?</p>
  
  <p>Thanks in advance!</p>