Question
Export PDF form error message of missing data using javascript
Hello all,
I have a pdf form that using javascript imports data from a txt file , populates the form and then exports each form as a PDF, then gets the next line of data , exports again etc etc . Now when i go to use it i get a missing data error even though i havent changed anything . Please help, code below
// specify the filename of the data file
var fileName = "/C/Docs/Book.txt"; // the tab delimited text file containing the data
var outputDir = "/C/Jobcard/"; // make sure this ends with a '/'
var err = 0;
var idx = 0;
while (err == 0) {
err = this.importTextData(fileName, idx); // imports the next record
if (err == -1)
app.alert("Error: Cannot Open File");
else if (err == -2)
app.alert("Error: Cannot Load Data");
// else if (err == -3)
// We are not reporting this error because it does
// indicate the end of our data table: We've exhausted
// all rows in the data file and therefore are done with
// processing the file. Time to exit this loop.
// app.alert("Error: Invalid Row");
else if (err == 1)
app.alert("Warning: User Cancelled File Select");
else if (err == 2)
app.alert("Warning: User Cancelled Row Select");
else if (err == 3)
app.alert("Warning: Missing Data");
else if (err == 0) {
event.target.display = display.hidden;
this.saveAs(outputDir + this.getField("Activity ID").value + "_" + this.getField("Order No").value + ".pdf").this.removeField("JobCard");
// saves the file
idx++;
}
}
