Response from server when using submitForm()

I'm at a loss here. The documentation on this is pretty non-exsistent (or I can't find it) and anything that came up on a google search is incorrect or incomplete.

I'm submitting XML data using the submitForm method. The submission works but Acrobat / Reader would display an error "An error occurred during the submit process. Cannot process content of type text/html"

I've changed the content-type headers in the response, but still don't know what I should send to get a simple popup/alert that tells the user ALL IS WELL. I don't need it to redirect or do anything fancy.

If I'm returning FDF data... what should it look like? Do I just make up FDF data with random fields? I've returned some FDF data, the error goes away, but nothing is displayed to the user.


Beau Brewer


3 Answers

Voted Best Answer

I've stumbed upon the answer. The FDF data needs to have a "Status". This is what I'm now returning and a simple popup is displayed. I read somewhere that the url that you are submitting to should have a #FDF at the end. i.e. http://www.mydomain.com/submit#FDF but I've tested it without and it still worked.

%FDF-1.2

1 0 obj

<<

/FDF << /Status (This form was sucessfully submitted.) >> >>

endobj

trailer

<<

/Root 1 0 R

>>

%%EOF

Hopefully this will help those that have run into this. My google search uncovered a number of complaints from users that were submitting forms and thought the error "An error occurred during the submit process. Cannot process content of type text/html" was something wrong with their computer.


By Beau Brewer   

You may be interested in reading this article:
http://acrobatusers.com/tutorials/form-submit-e-mail-demystified

The return data does not need to be FDF, it could be XML, XFDF, or XDP. My understanding was that Acrobat 8 and later is supposed to take HTML if the "#FDF" is left off the submission URL. But I haven't tested it.

The only important bit about returned FDF is that it is correctly formatted and the mime type is setup correctly in the response header. I do not believe it actually needs to contain anything.

I like to put a short script in the returned FDF that redirects the user to a webpage. But the status entry works brilliantly as well.

Thom Parker
The source for PDF Scripting Info pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker   

As it has been shown, Reader does not know what to do with the HTML answer from the server, and therefore throws an error.

One possibility would to send back a very basic PDF, containing the text that the data has been recieived successfully. Of course, a more elaborate receipt could be sent back as weill.

One possibility with the FDF would be sending back one field (non-existant; it will simply be ignored) and then also JavaScript with the /After command, and that JavaScript could, for example do an app.alert() with a confirmation text.

Hope this can help.


Max Wyss   


Please specify a reason: