Copy link to clipboard
Copied
Hi,
I have a form with 15 questions, for each question, there are 3 answers (A, B, and C). at the end of the form, there is a table for the results (A, B, and C).
I need to count the number of selections for each one (example: A: 7, B: 3, C: 5). I set the export value for A answers as "A" and so on..
I tried to search for a solution but couldn't find anything.
Your help is greatly appreciated.
Thanks
You can use this code to count the number of instances "A" was selected, and with minor adjustments the rest of them:
var total = 0;
for (var i=1; i<=15; i++) {
if (this.getField("Check Box"+i).valueAsString=="A") total++;
}
event.value = total;
Copy link to clipboard
Copied
What are the names of the fields?
Copy link to clipboard
Copied
Check Box1
Check Box2
Check Box3
Till
Check Box15
Copy link to clipboard
Copied
I think this was just answerd but using radio buttons in this thread: https://community.adobe.com/t5/acrobat/calculation-to-score-a-quiz-with-radio-buttons/m-p/11573478#M...
Copy link to clipboard
Copied
That's a different scenario, in your reply, the final calculation is the result of all selections as one sum.
In my case, I need to know how many A, B, and C. Therefore, there are 3 calculators, one to count A, one to count B and one to count C
Refer to this example https://www.dropbox.com/s/jv3axw68zkwgr7p/Example.pdf?dl=0
Copy link to clipboard
Copied
You can use this code to count the number of instances "A" was selected, and with minor adjustments the rest of them:
var total = 0;
for (var i=1; i<=15; i++) {
if (this.getField("Check Box"+i).valueAsString=="A") total++;
}
event.value = total;
Copy link to clipboard
Copied
Thanks,
It's working. -:)
Unfortunately, it looks that the built-in PDF viewers on Edge and Chrome don't support that sort of thing...
Copy link to clipboard
Copied
"Unfortunately, it looks that the built-in PDF viewers on Edge and Chrome don't support that sort of thing..."
All PDF form makers should know this great trick:
https://www.abracadabrapdf.net/ressources-et-tutos/creation/forcer-utilisation-pdf-avec-acrobat-read...
(Google translate is your friend)