2 Replies Latest reply on Mar 2, 2011 8:59 PM by joetanksley

    If statements


      I would like to write a script that looks at 3 different check boxes and if any of them are checked they cause the field to return ".08" otherwise it returns ".1".  Any help out there?

        • 1. Re: If statements
          George_Johnson MVP & Adobe Community Professional

          If you mean that you want to set a field value to either 0.8 or 0.1 based on the check boxes, then you can use a custom calculation script for the field, something like the following:


          // Custom Calculate script for text field
          (function () {
              var bSelected = false;
              // Loop through the check boxes to see if any are selected
              for (var i = 1; i < 4; i++) {
                  if (getField("cb" + i).value !== "Off") {
                      bSelected = true;
              // Set this field value
              event.value = bSelected ? .08 : .1;


          This code assumes the check box names are "cb1", "cb2", and "cb3", so you'd have to modify it to match your fields.

          • 2. Re: If statements
            joetanksley Level 1

            George, THANKS ALOT! It worked.  I just changed my check boxes to "cb1, cb2 & cb3"  You're AWESOME!