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

Converting Check Boxes into a number

New Here ,
May 23, 2019 May 23, 2019

I have a list of items labeled Check Box 1 to Check Box 30.  I need to calculate how many actually get checked.  I am so new to this so step by step would be helpful.

Thanks!

TOPICS
Acrobat SDK and JavaScript , Windows
256
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
Community Expert ,
May 23, 2019 May 23, 2019
LATEST

You can use this code as the custom calculation script of the field where you want to display the result:

var total = 0;

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

    var fname = "Check Box "+i;

    var f = this.getField(fname);

    if (f==null) {app.alert("Error! Can't find: " +fname); continue;}

    else if (f.valueAsString!="Off") 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