These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Problem with double entries in the FDF Toolkit

ST
Registered: Nov 24 2008
Posts: 26

I recently installed the FDF Toolkit on a Windows server with IIS/6.0, and I'm having problems getting one of the sample forms, ParsePDF.pdf, to run correctly with the ASP file, ParseFDF.

When I submit the form over the web so that it will write to an Access database, for some reason all the fields get written to the database twice! But, if I just open up the form on the server, fill in the fields, and hit the submit button, I'll get the desired single entry in the database.

I thought the problem might be related to the fact that I was sending ALL of the form fields when I hit the submit button, which was causing the SUBMIT button to also be sent. And so I changed it to only submit the three fields of interest, which you can see in this screen shot -- [url]http://www.buffalostate.edu/centers/chsr/FieldSelectionBox.pdf [url]. Unfortunately, that didn't solve the problem, and I'm not sure what to do. (I even created a simple ASP file with the same fields, and found that it only writes the data once to the database, leading me to think that the problem is localized in either the Fillable pdf, or the FDF Toolkit.)
Any feedback is greatly appreciated.

Sheldon

p.s. In case it helps, I've included two different versions of the ASP/SQL code that both produce double entries.

objRS.Open "Survey1","dsn=Survey",2,2
objRS.AddNew
objRS("Respondent") = customerName
objRS("Address") = customerAddress
objRS("Selection") = customerComboBox
objRS.Update
objRS.Close

objConn.Open("DSN=Survey")
strSQL = "INSERT INTO Survey1 (Respondent,Address,Selection) VALUES ('" & customerName & "' , '" & customerAddress & "' , '" & customerComboBox & "')"
objConn.Execute(strSQL)
objConn.Close

Sr. Research Analyst
Buffalo State Collge

My Product Information:
Acrobat Standard 8.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
What browser and version of Acrobat (or Reader) does this happen with?

George
ST
Registered: Nov 24 2008
Posts: 26
I'm using Acrobat 8 Professional along with Internet Explorer 7.0. When I saw your response I also downloaded Firefox 3.0, but the same thing happens with that browser.

Sheldon

Sr. Research Analyst
Buffalo State Collge

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Interesting. What I would do is check the server logs to see if the form is submitting twice for some reason. I seem to recall from some time ago this being a problem if the response generated by the server is HTML. What type of response is the server generating in response to a form submission?

Also, what does the submit to URL look like?

George
ST
Registered: Nov 24 2008
Posts: 26
I won't be able to give you information on the server logs until tomorrow, but I can say something about the response or output format the server is producing. IE 7 seemed to be generating an html/asp page, but when I submitted it from Firefox 3, it rendered like a text page that was just interpreting html tags as text. For example, it just showed

Sample Form Processing PageResults:Customer Name:John DoeCustomer Address:123 ElmstreetCustomer ComboBox:Item 2etc...

The corresponding code in the ASP program that gets called during submission is:
<%@ Language=VBScript %><% Option Explicit %><!-- #include file= "adovbs.inc" --> <html><head><title>Sample Form Processing Page</title></head> <body> <% Dim FdfAcX

Dim FDFin

Dim customerName

Dim customerAddress

Dim customerComboBoxCreate the FDF App Object

Set FdfAcX = Server.CreateObject("FdfApp.FdfApp")'Create the FDFSet FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes))

 customerName = FDFIn.FDFGetValue ("Name") customerAddress = FDFIn.FDFGetValue ("Address") customerComboBox = FDFIn.FDFGetValue ("ListBox") '
Send back the resultsResponse.ContentType = "text/plain"Response.AddHeader "content-disposition", "filename='parseFDF.txt'" Response.Write "Results:" + "<br>" '+ vbcrlfResponse.Write "Customer Name:" + customerName + "<br>" '+ vbcrlfResponse.Write "Customer Address:" + customerAddress + "<br>" '+ vbcrlf

I thought about changing these two lines..

Response.ContentType = "text/plain"
Response.AddHeader "content-disposition", "filename='parseFDF.txt'"

..., but wasn't sure how to do it.

Hopefully this information answers at least some of your questions....

Sheldon

Sr. Research Analyst
Buffalo State Collge

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
That server script is set up to return a text response, as opposed to HTML, or something else like an FDF. The double-post problem can happen if you append an "#FDF" to the URL in the submit action and the server does not return an FDF (or XFDF, etc.).

So if your submit to URL looks something like:

http://www.example.com/example.asp#FDF

Change it to:

http://www.example.com/example.asp

In other words, get rid of the "#FDF".

Also, why is the script set up to return a text response?

George
ST
Registered: Nov 24 2008
Posts: 26
Getting rid of the #FDF did indeed solve the problem!

I included it is because that's what one of the manuals that came with the Toolkit said to do. I didn't really want to return a text response.

When a user submits a form, I really want to redirect them to a different html/asp page within the web site. Can you tell me how to change it so I can return html?

Sheldon

Sr. Research Analyst
Buffalo State Collge

ST
Registered: Nov 24 2008
Posts: 26
p.s. I neglected to thank you several times for resolving this mystery. I'm very new to Acrobat and have had difficulty finding reference materials outside of the manuals that come with the toolkit...

Sr. Research Analyst
Buffalo State Collge

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
If you want to simply redirect to a static web page or a different ASP, the response could be an FDF that simply contains a /F key that points to the page you want to redirect to. You'd do this with the FDF Toolkit by creating an output FDF and using the FDFSetFile method of the FDF Toolkit. There are some samples that show you how to return an FDF response, in which case you would need to append a "#FDF" to the end of the submit to URL.

George
ST
Registered: Nov 24 2008
Posts: 26
I've been looking through the "FDF Toolkit Overview and Reference" Manual and I just want to make sure I'm clear about what you mean by creating a /F key to point to a redirection page. Are you referring to the "GenerateFDF.asp" code included in the Samples? i.e.
Set FdfAcX = Server.CreateObject("FdfApp.FdfApp") Set outputFDF = FdfAcX.FDFCreate outputFDF.FDFSetValue "Date", "December 31 1999", FalseoutputFDF.FDFSetValue "Name", "John Clay", FalseoutputFDF.FDFSetValue "Address", "12 Saratoga Ave", FalseoutputFDF.FDFSetValue "City", "Saratoga", FalseoutputFDF.FDFSetValue "State", "CA", False outputFDF.FDFSetFile "http://localhost/FDF_PDFs/generateFDF.pdf"Response.ContentType = "application/vnd.fdf"Response.BinaryWrite outputFDF.FDFSaveToBuf outputFDF.FDFClose

In my case, I guess I'd want to have the results go to "generateFDF.asp" instead of "generateFDF.pdf" But if that's correct, it seems like I could do the same thing much more simply by using a Response.Redirect within ASP. In terms of the ParseFDF code listed above, I could just add this line
Response.Redirect "Results.asp?name=" & customerName & "&address=" & customerAddress & "&choice=" & customerComboBox & ""
and then create the Results.asp file to pull down the values in the query string. I've tried this simpler option and it worked fine. Any information about the relative merits of the other code would be appreciated.

However, I just want to re-iterate how much your feedback and suggestions have helped me. My project would have been at a stand-still without your advice!

Sheldon

Sr. Research Analyst
Buffalo State Collge

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
That first example you posted is demonstrating sending an FDF response back to the user. When the FDF is received by the user, the PDF specified in the /F key will get loaded and the data in the FDF will populate the fields in the PDF.

If what you want to do in response to a PDF form posting is read the data, store it in a database, and then send the user to a new page or ASP, I've found that returning an FDF with the "redirect" URL specified in the /F key to be more reliable, particularly with older versions or Acrobat/Reader. Feel free to use whichever you like, just do as much testing as you can with different combinations/versions of OS/Browser/Acrobat(Reader).

George