count number of specific answers
Hi,
I've created a PDF form with yes/no questions. In the last field I want to see the summary of the amount of 'ja' (= yes) answers.
The field ID's range from Tekstveld 1 (= Text Field) to Tekstveld 37, with no. 38 as the 'total' field.
I've found a Java code and tried to edit it to my needs, but I'm not getting it...
// Initialize counter variable
var sum = 0;
// Loop through the fields
for (var i = 1; i < 37; i += 1) {
// Add one if Teksveld is set to ja
if (getField("Tekstveld" + i).value !== "ja") {sum += 1;}
}
// Set this field's value to the sum
event.value = sum;
Can someone help me to get it right?
Thanks!
