I have a file upload form (see end of email) that I am am processing
with jQuery so that it can be submitted via AJAX. When I click the
submit button, the form sends as it should (I can see the submit went
properly in the server logs). However, the response doesn't get
handled properly. In the response, I get a file download dialog
(firefox), although the page itself isn't replaced:

"You have chosen to download
idcplg
which is a text/json
from: test-server.mydomain.edu
[...]"


The code I have to setup javascript is as follows (there are no
javascript errors on page load or form submit):
.
  <script type="text/javascript" src="/content/jq/jquery.js"></script>
  <script type="text/javascript" src="/content/jq/jquery.form.js"></
script>
  <SCRIPT type="text/javascript">
    // wait for the DOM to be loaded
    $(document).ready(function()
    {
      var options =
      {
        dataType:      'json',
        success:       function(data)
        {
          var out = document.getElementById("OUTPUT");
          out.innerHTML = "";
          out.innerHTML += "Response Text:" + data + "<BR>";
        };
        // bind form using 'ajaxForm'
        $('#ReportUploadForm').ajaxForm(options);
      });
    </SCRIPT>


Any idea what I might be doing wrong?

Thanks,
-Jim Stapleton


The Form (some values are filled in with javascript after load, or
when items are selected from the select box):

<FORM NAME="ReportUploadForm" ACTION="/content/idcplg"
ID="ReportUploadForm" STYLE="PADDING: AUTO; MARGIN: AUTO;"
method="POST" enctype="multipart/form-data">
  <INPUT TYPE="HIDDEN"    NAME="dSecurityGroup" ID="dSecurityGroup"
VALUE="Authenticated">
  <INPUT TYPE="HIDDEN"    NAME="dDocAuthor"  ID="dDocAuthor"
VALUE="<!--$dUser-->">
  <INPUT TYPE="HIDDEN"    NAME="dDocType"    ID="dDocType"
VALUE="Reports">
  <INPUT TYPE="HIDDEN"    NAME="IdcService"
VALUE="CHECKIN_UNIVERSAL">
  <INPUT TYPE="HIDDEN"    NAME="dDocName"    ID="dDocName"
VALUE="">
  <INPUT TYPE="HIDDEN"    NAME="dDocTitle"   ID="dDocTitle"
VALUE="">
  <INPUT TYPE="HIDDEN"    NAME="dDocAccount" ID="dDocAccount"
VALUE="">
  <INPUT TYPE="HIDDEN"    NAME="IsJson"      ID="IsJson"
VALUE="1">
  <TABLE STYLE="MARGIN: AUTO; PADDING: AUTO;">
    <TR>
      <TD>Report</TD><TD><SELECT                 NAME="ReportType"
ID="ReportType"></SELECT></TD>
    </TR><TR>
      <TD>File</TD><TD><INPUT TYPE="FILE" ID="primaryFile"
NAME="primaryFile"></TD>
    </TR>
  </TABLE>
<DIV STYLE="WIDTH=75%; MARGIN: AUTO; PADDING: AUTO; TEXT-ALIGN:
CENTER;">
  <INPUT TYPE="SUBMIT" NAME="CHECKIN" ID="CHECKIN" VALUE="Check In"
STYLE="MARGIN: AUTO; PADDING: AUTO;">
</DIV>
</FORM>

Reply via email to