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

counting Empty Text fields

SEVP
Registered: Jul 1 2008
Posts: 9

I created a form in acrobat with 6 text fields,

Text field names
11
12
13
14
15
16

Is there a way that I can count how many text fields have data "N/A" entered?

My Product Information:
Acrobat Pro 8.1.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Check the value of each field and see if the value is equal to "N/A" and if it is then count it.

var emptyCount = 0; // count of empty fields
var NACount = 0; // count of field with a value of 'N/A"

for (i = 0; i < 6; i++) {
if (this.getField(11 + i).valueAsString.toUpperCase() == "")
emptyCount++; // increment empty count
if (this.getField(11 + i).valueAsString.toUpperCase() == "N/A")
NACount++; // increment N/A count
} // end for loop

app.alert("Number of empty fields: " + emptyCount + "\nNumber of fields with N/A: " + NACount, 3, 0);

George Kaiser

SEVP
Registered: Jul 1 2008
Posts: 9
Hi, This works great, how would i tell it instead of getting the result on ta pop window, to assing the N/A results to a text box named "Pos1"?