1 Reply Latest reply on Sep 30, 2013 10:33 AM by try67

    tallying check marks

    mseverns23

      I have an evaluation form where I need to tally up the total amount of boxes that are checked in given columns.   So for example I have a column with boxes named 1.1U, 1.2U, 1.3U, & 1.4U, and an over all rating box 1Utotal.  Is there a script that can look at the four boxes and then produce a number for how many of them are checked?

        • 1. Re: tallying check marks
          try67 MVP & Adobe Community Professional

          You can use something like this as a doc-level script:

           

          function countCheckBoxes(names) {

               var total = 0;

               for (var i in names) {

                    var f = this.getField(names[i]);

                    if (f.value!="Off") total++;
               }

               return total;

          }

           

          And then in your total field you use this code as the custom calculation script:

          event.value = countCheckBoxes(["1.1U", "1.2U", "1.3U", "1.4U"]);