0 Replies Latest reply on Oct 7, 2012 11:22 PM by Danelsan2

    Toggle Checkbox to control 2 groups of checkboxes

    Danelsan2

      Hello. I don't know much about programming, and the Adobe Javascript reference document is proving less useful than I hoped (though it did get me started).

       

      Anyway, I have the following issue to solve in Acrobat X Pro: I want a checkbox that will check or uncheck other checkboxes depending on its status.

       

      As an example, I could have 5 check boxes, with checkbox 3 being my "control".

       

      if box 3 is checked, then boxes 1 and 2 should also be checked (boxes 4 and 5 could be either way, doesn't matter).

      if box 3 is unchecked, then boxes 4 and 5 should be unchecked too (while boxes 1 and 2 could be either way).

       

      So, I give checkbox 3 the following mouse up action:

       

          var b1 = this.getField("Checkbox1");

          var b2 = this.getField("Checkbox2");

          var b3 = this.getField("Checkbox3");

          var b4 = this.getField("Checkbox4");

          var b5 = this.getField("Checkbox5");

          var b3Status = (b3.isBoxChecked(0));

        if (b3Status = true)

      {

          b1.checkThisBox(0,true);

          b2.checkThisBox(0,true);

      }

        else

      {

          b4.checkThisBox(0,false);

          b5.checkThisBox(0,false);

      }

       

      This is, however, not working as I intended. While it does check boxes 1 and 2 when I check box 3, I have two issues: first, unchecking boxes 3 is not unchecking boxes 4 and 5. Second, boxes 1 and 2 are also getting checked when I uncheck box 3.

       

      Could someone point out how to correct the code so that these issues are solved?

       

      Regards,

       

      Danelsan2