Tallying answers in textboxes

Explorer ,
Feb 29, 2020 Feb 29, 2020

Copy link to clipboard

Copied

I have 15 rows of radio buttons. The export values are Reinforce, Refine and Redirect and they appear at the end of each row of buttons in a textbox. I would like to tally the number of times each value is selected and show it in 3 separate textboxes.

Example: Number of times Reinforce is selected. Number of times Refin is selected, etc.

 

All of you who answer here are amazing! I really appreciate what you do!

TOPICS
Acrobat SDK and JavaScript, Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

39

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Explorer , Feb 29, 2020 Feb 29, 2020
I found the answer. Thanks!Incase someone else needs something like this, here it isI have 3 textboxes and changed the other box scripts var testFor values to Refine and Redirect.The textfields are named RGBGroup.1, RGBGroup.2, up to .15: var testFor = "Reinforce"; var groups = this.getField("RGBGroup"); var ar = groups.getArray(); var cnt = 0; for (var i=0; i<ar.length; i++) { if (ar[i].value == testFor) { cnt++; } } event.value = cnt;

Likes

Translate

Translate
Explorer ,
Feb 29, 2020 Feb 29, 2020

Copy link to clipboard

Copied

LATEST

I found the answer. Thanks!

Incase someone else needs something like this, here it is

I have 3 textboxes and changed the other box scripts var testFor values to Refine and Redirect.

The textfields are named RGBGroup.1, RGBGroup.2, up to .15:

 

var testFor = "Reinforce";
var groups = this.getField("RGBGroup");
var ar = groups.getArray();
var cnt = 0;
for (var i=0; i<ar.length; i++) {
if (ar[i].value == testFor) {
cnt++;
}
}
event.value = cnt;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines