Copy link to clipboard
Copied
Im trying to add all the "Yes" and all the "No's" in each column. I'm using the following script that does not seem to work for me.
var total = 0; for (var i=1; i<=60; i++) { var fields = this.getField("Check Box "+i).getArray(); for (var j in fields) { if (fields[j].valueAsString!="Off") total++; } } event.value = total;
I named the check boxes 1-60 the same for each question with a differant value in each (yes,no), so the end user can not check a yes and no for the same answer. Need a little help on this script. Not sure what I'm doing wrong.
Copy link to clipboard
Copied
This script is not quite what you need. Use this:
var total = 0;
for (var i = 1; i <= 60; i++) {
var f = this.getField("Check Box "+i);
if (f.valueAsString=="yes")
total++;
}
event.value = total;
Note that JS is case-sensitive, so "yes" and "Yes" are not the same thing...
Copy link to clipboard
Copied
This script is not quite what you need. Use this:
var total = 0;
for (var i = 1; i <= 60; i++) {
var f = this.getField("Check Box "+i);
if (f.valueAsString=="yes")
total++;
}
event.value = total;
Note that JS is case-sensitive, so "yes" and "Yes" are not the same thing...
Copy link to clipboard
Copied
That did the trick. Thank you so much!!!!!!!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more