Hi. I'm using the FDF Toolkit and some ASP code to send the form values in a fillable PDF
to an Access database over the web. Everything works perfectly if you make a response
to every question on the form. And, I've also gotten it to deal with missing values for multi-choice
radio button questions that have numerical values. However, my code crashes whenever it
encounters an empty text field, and nothing I've tried seems to work. To be more specific...
' Create the FDF App Object Dim FdfAcX, FDFin Set FdfAcX = Server.CreateObject("FdfApp.FdfApp") 'Create the FDF Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes)) Q1 = FDFIn.FDFGetValue ("b12c96nfANews_1") ' value from a radio button Q6Field1 = FDFIn.FDFGetValue ("b12c96nmUArt_1") ' value from a text field etc... 'To deal with missing radio button questions, I do this test before writing to the database 'and it screens out Q1 very nicely if IsNumeric(Q1) then objRS2a("anews_1") = Q1 end if 'But this kind of test always results in this error '80040204' /chsr/ParseECCPASA.asp, line 48 if IsString ( FDFIn.FDFGetValue ("b12c96nmUArt_1") ) then 'line 48 Q6Field1 = FDFIn.FDFGetValue ("b12c96nmUArt_1") else Q6Field1 = "blank" end if
I've also tried to screen out the missing value using IsEmpty, and IsNull but the same kind of error
occurs, and I've even tried to figure what's being sent by using
TypeName(FDFIn.FDFGetValue ("b12c96nmUArt_1")) but that doesn't give any other clues.
To add insult to injury, after I get an error message, a few seconds later the web browser
with the pdf will often crash with the following alert box:
Adobe Acrobat: firefox.exe Application Error
The exception unknown software exception (0xc000000d) occurred in the application at location...
If anyone can tell me how I can resolve this problem of missing text field values, I'd be very
appreciative.
ST
If I first do this assignment
Q6 = Cstr( FDFIn.FDFGetValue ("b12c96nmUArt_1") )
I've been able to show that it correctly counts the length of any non-zero
string and it will even correctly process the field when I put in a non-zero length
blank string " " in the field and then hit submit.
But, when I do the following test and give it an empty field, the code always
crashes and won't write anything to the database.
I even tried to put some javascript validation in, to precede the
submit command before someone clicks on the button.
var lucky = this.getField("b12c96nmUArt_1").value;
if (lucky == "")
{
lucky.value = "blank";
}
But, it didn't work. The only other thing I can think of is a messy cluge --
in the text field properties I can set a default value of "Enter response here"
and then hope that people will leave it there if they don't want to write anything.
I'm also still trying to figure out why the browser sometimes crashes after a submission.
I'm wondering if it's because I'm using a simple Response.Redirect to get them to a
new web page, rather the opening an output stream with the FDF toolkit.
Any feedback on either question is certainly appreciated.
Sheldon
Sr. Research Analyst
Buffalo State Collge