Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Summing a grid of radio buttons by column

New Here ,
Feb 24, 2017 Feb 24, 2017

I'm trying to figure out how to sum a column of radio buttons. I've been presented with a form with 5 categories or questions that need to be rated from 1 to 5.  The layout is something like:

Q1:  1     2    3    4    5

Q2:  1     2    3    4    5

Q3:  1     2    3    4    5

Q4:  1     2    3    4    5

Q5:  1     2    3    4    5

       T1  T2  T3  T4  T5

          Grand Total

The idea being that as someone rates each question, the value of the checkbox they select is then summed at the bottom of the column so I wind up with a total of the 1s that were checked, 2s, etc.  I can do singleton radios or checkboxes but am a bit lost with multiples like this and would appreciate some assistance

Many thanks in advance.

TOPICS
Acrobat SDK and JavaScript
599
Translate
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

Community Expert , Feb 25, 2017 Feb 25, 2017

Whatever you use, put the value of each field as its export value (for check-boxes) or "radio button choice" value (for radio-button).

You can then use something like this as the custom calculation code of the T1 field, for example:

var total = 0;

for (var i=1; i<=5; i++) {

    if (this.getField("Q"+i).valueAsString=="1") total++;

}

event.value = total;

Translate
Community Expert ,
Feb 25, 2017 Feb 25, 2017

Whatever you use, put the value of each field as its export value (for check-boxes) or "radio button choice" value (for radio-button).

You can then use something like this as the custom calculation code of the T1 field, for example:

var total = 0;

for (var i=1; i<=5; i++) {

    if (this.getField("Q"+i).valueAsString=="1") total++;

}

event.value = total;

Translate
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
New Here ,
Feb 25, 2017 Feb 25, 2017
LATEST

This was perfect.  I realized I got confused by the terminology Adobe was using for the value and took 'Radio Button Choice' to mean the field name and not the actual value.  Anyway, that works perfectly and I'll have a very happy co-worker on Monday as a result.

Thank you so much.

Translate
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