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

Converting Check Boxes into a number

New Here ,
May 23, 2019 May 23, 2019

Copy link to clipboard

Copied

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

Views

183

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
Community Expert ,
May 23, 2019 May 23, 2019

Copy link to clipboard

Copied

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;

Votes

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