4 Replies Latest reply on Apr 28, 2011 9:04 AM by klakhouse

    Multiple checkboxes

    DJBAN

      Hi all, I am new to acrobat forms, so this will probably sound a bit rudimentry for some.  I have a form with two main checkboxes.  The first main checkbox I want to make it check all of the 12 subset checkboxes.  The second main checkbox I want to check so it unchecks all 12 of the same subset checkboxes that were checked by the first main checkbox.  All of which I can do.  What I want to be able to do is after unchecking the 12 subset checkboxes is to be able to randomly check any of the 12 subset checkboxes without all 12 being checked!!!!!!  Heeeeeeeeeelp!!!  I don't understand java scripting but I'm hoping someone will show me a script that would work, thanks, DJBAN

        • 1. Re: Multiple checkboxes
          gkaiseril MVP & Adobe Community Professional

          Do you know any programing?

           

          Acrobat JavaScript is ECMA-262 compatible and has a number of unique properties and methods documented in the Acrobat SDK documentation in the Acrobat JS API Reference and Guide. Acrobat JavaScript like JavaScript is an Object Orientated Language, so you first need to access the field object and then you can change one of  its properties or use one of its methods.

           

          To check all the named fields one could use for a button or other field:

           

          // create array of field names to process
          var aFields = new Array ('Check Box1', 'Check Box2', 'Check Box3', 'Check Box4');
          // process using the array of field names
          for (i = 0; i < aFields.length; i++) {
             // get field name 'i'
             var cName = aFields[i];
             // use the 'checkThisBox' method to check the check box
             this.getField(cName).checkThisBox({nWidget: 0, bCheckIt: true});
             }

           

          To uncheck all the named fields one could use for a button or other field:

           

          // create array of field names to process
          var aFields = new Array ('Check Box1', 'Check Box2', 'Check Box3', 'Check Box4');
          // process using the array of field names
          for (i = 0; i < aFields.length; i++) {
             // get field name 'i'
             var cName = aFields[i];
             // use the 'checkThisBox' method to uncheck the check box
             this.getField(cName).checkThisBox({nWidget: 0, bCheckIt: false});
             }

          • 2. Re: Multiple checkboxes
            DJBAN Level 1

            No, I don't know any programg, but thanks for your patience. I'm uploading the form for you to look at.  What I've got is the box FULL to check all 12 subset boxes.  Uncheck FULL and it unchecks all 12 subset boxes.  Check FULL, checks all 12 subset boxes.  Check PARTIAL and it unchecks all 12 subset boxes, then I can check any of the 12 subset boxes randomly and individually without it checking all of the rest of the 12 subset boxes.  I would really appreciate any help you can give me.  If anyone were to fix it I could read the code and probably understand it.  Here's the form, thanks djban!

            • 3. Re: Multiple checkboxes
              gkaiseril MVP & Adobe Community Professional

              You need to learn about form from field types, naming, and values. With use of a Radio Button group for 'Investigation' one can clear selected named fields for the 'Partial' option. But you need to uniquely name the check boxes for the requested items and have an export value of 'Yes' for each check box. With unique names and the same export value, you can use a short JavaScript to set the value of each field to 'Yes'.

              • 4. Re: Multiple checkboxes
                klakhouse

                I have a similar issue and have been able to use the "true" formula to have other checkbox fields populate a check mark. How can this same master control un-check the controlled checkbox fields without need of a second field? In other words, if the master control field is checked the controlled fields are checked and if the master control field is un-checked the controlled fields are un-checked.

                 

                Thanks!
                klakhouse