4 Replies Latest reply on Apr 1, 2011 12:10 PM by George_Johnson

    if statement



      I am trying to add an if statement to a check box. If the box is checked I would like a certain set of OCGs to show, and if it is unchecked, I would like those same OCGs to disappear. How would i go about doing this?

        • 1. Re: if statement
          try67 MVP & Adobe Community Professional

          You use something like this:


          if (some_condition_is_true) {

          // do this code

          } else {

          // do this code


          1 person found this helpful
          • 2. Re: if statement
            jbe2011 Level 1

            what is the command to get the export value?

            i was thinking something like:

            if (button("one").exportValues == yes) {

            // do something}

            Im not sure what the code would be for the bold/underlined part. I probably butchered it terribly.

            • 3. Re: if statement
              gkaiseril MVP & Adobe Community Professional

              For the value of the field it is just the ".value' property. The '.exportValues' property will return an array of the export value for each field in the group of check boxes or radio buttons..


              The export value is only for setting an individual check box or radio button in the UI.


              You might want to get or link to the Acrobat JavaScript in the Adobe Developer Connection.

              • 4. Re: if statement
                George_Johnson MVP & Adobe Community Professional

                Just get the value of the field, When a check box is not selected, its value will be equal to the string "Off", but not "off", "OFF", false, or anything else:


                if (getField("button_one").value !== "Off") {
                    // do something