Copy link to clipboard
Copied
I am looking to expand on another calculation script I am using for counting check boxes.
My PDF Document has a series of questions with which a "Yes" "No" or "N/A" option can be checked. The check boxes are named in the following format:
Yes.Q1, Yes.Q2, Yes.Q3...
No.Q1, No.Q2, No.Q3...
Na.Q1, Na.Q2, Na.Q3...
This is what I am using in order to count "Yes" answers on the checklist in a field below:
var nSum = 0;var aCkFlds = this.getField("Yes").getArray();for(var i=0;i<aCkFlds.length;i++){if(aCkFlds.isBoxChecked(0))nSum++;}event.value = nSum;
This works great for that. I want to expand the script for another field in which it will add the "Yes" and "No" in order to get a count of all "Applicable Items" in the checklist.
Any assistance would be appreciated.
This should do the trick:
var nSum = 0;
var yesFields = this.getField("Yes").getArray();
for (var i=0; i<yesFields.length; i++){
if (yesFields.isBoxChecked(0)) nSum++;
}
var noFields = this.getField("No").getArray();
for (var i=0; i<noFields.length; i++){
if (noFields.isBoxChecked(0)) nSum++;
}
event.value = nSum;
Copy link to clipboard
Copied
This should do the trick:
var nSum = 0;
var yesFields = this.getField("Yes").getArray();
for (var i=0; i<yesFields.length; i++){
if (yesFields.isBoxChecked(0)) nSum++;
}
var noFields = this.getField("No").getArray();
for (var i=0; i<noFields.length; i++){
if (noFields.isBoxChecked(0)) nSum++;
}
event.value = nSum;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now