6 Replies Latest reply on Mar 17, 2009 1:43 PM by Adam Cameron

    CF8 - Ajax Form Post and Document Type

    tSpark Level 1
      I'm having a problem trying to figure out how to get a form post to return a PDF document using CF8. I can't seem to get CFDOCUMENT to deliver a PDF through the form.

      I have a form inside a CFDIV...

      <cfdiv id="mydiv">
      <cfform action="myscript.cfm" method="post">
      a bunch of input fields, then...
      <input type="submit" value="Generate PDF" />

      On submit, the form makes an Ajax call sending the data to a script that generates a PDF using CFDOCUMENT and delivers it through the browser.

      However, it is not delivering the PDF. Instead, it is delivering the CODE for the PDF into the CFDIV and trying to display the code. I tried the same form delivering an Excel file with cfcontent and cfheader. It delivers the code instead of the actual document.

      If I take this form out of the CFDIV, everything works great.

      Why can't the Ajax call made by the CFDIV functionality deliver a PDF or other file?