Skip to main content
Inspiring
March 1, 2020
Answered

Tallying answers in textboxes

  • March 1, 2020
  • 1 reply
  • 387 views

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!

This topic has been closed for replies.
Correct answer cptmcnair

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;

1 reply

cptmcnairAuthorCorrect answer
Inspiring
March 1, 2020

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;