6 Replies Latest reply: Jul 24, 2012 2:11 PM by Vadergod RSS

    Actions tab for form field properties

    community help Community Member

      This question was posted in response to the following article: http://help.adobe.com/en_US/acrobat/pro/using/WSDFC888F9-219C-4b55-90E6-D316E2A85F08.w.htm l

        • 1. Re:  Actions tab for form field properties
          Vadergod

          I have 103 action entries for the show/hide fields.  It will not let me add further actions.  Is there a limit of how many actions can be added?  Is there an alternative way to create action items that will not limit how many action items you can add?  I am compiling several form requirments (10 in to 1) and the features depending on the selection would show or hide other features not needed for a specific form requirement.  This saves time and paper processing.  any help will be greatful.

           

          ~Los

          • 2. Re:  Actions tab for form field properties
            George_Johnson ACP/MVPs

            It is very difficult to manage showing/hiding of a lot of fields using the Show/Hide Field action. It is usually much easier to use JavaScript, and if you use hierarchical naming for the fields that you want to control, it becomes evern easier. Here is some sample code:

             

            // Show the field named "text1"

            getField("text1").display = display.visible;

             

            // Hide the field named "text1"

            getField("text1").display = display.hidden;

             

            // Hide the group of fields with the "group1" field name prefix (e..g., "group1.text1", "group1.radio2", "group1.dropdown1", etc.)

            getField("group1").display = display.hidden;

             

             

            You can add code to toggle a field or group of fields when a button is clicked, of add code to a check box so that when it is selected, certain fields are displayed, but hiden when it's not.

            • 3. Re:  Actions tab for form field properties
              Vadergod Community Member

              George,

              The sample worked just fine, but when i 'unchecked' the action item it did not release the hidden items.  Is there another entry i can add to specify that if i unchecked the box, it would put back the items it hid?  I really appreciate your assistance, i'm not very knowledgeable with JavaScript, but i am able to follow the example and identify what it is trying to do.  with your provided sample i was able to perform a large JavaScript, but my only challenge now is to get everything back once I uncheck my selections.  Again, you are awesome and you have opened a can of worms for my mind, which by the way i find exciting and have even asked our company to send me to a class and get further into JavaScripting to better utilize the skills for what we do.  Any suggestions for beginner classes? 

               

              ~Los

              • 4. Re:  Actions tab for form field properties
                George_Johnson ACP/MVPs

                Here is a simple example that uses a check box to show/hide a single text field. Is should be placed as the check box's Mouse Up script:

                 

                (function () {

                 

                    // Get a reference to the text field

                   var f = getField("text1");

                 

                    // Show/Hide the text field based on the sate of this check box

                    if (event.target.value === "Off") {

                        f.display = display.visible;

                    } else {

                        f.display = display.hidden;

                    }

                 

                })();

                 

                This hides the text field when the check box is selected and shows it when it's not. The first and last lines are not necessary, but they prevent the unnecessary creation of document-global variables, which is a good thing.

                 

                The script can be reduced to the following equivalent code:

                 

                (function () {

                 

                    // Get a reference to the text field

                   var f = getField("text1");

                 

                    // Show/Hide the text field based on the sate of this check box

                    f.display = event.target.value === "Off" ? display.visible : display.hidden;

                 

                })();

                 

                The best place to learn more about JavaScript programming in Acrobat is the subscription-based site pdfscripting.com, and the best free site is acrobatusers.com with its many tutorials. You may find some classes out there, but since I haven't taken any of them, I have none to suggest or recommend.

                • 5. Re:  Actions tab for form field properties
                  Vadergod Community Member

                  Thank you so much, George!!!  You are the best!  This has helped me move forward on the consolidation.  I made sure to give you credit with my peers.

                   

                  ~Los

                  • 6. Re:  Actions tab for form field properties
                    Vadergod Community Member

                    George,

                     

                    sorry to bother once again.  First of all, thank your for your assistance and i have begun learning about Basic Java Scripting and it's a bit confusing.  I used one of your entries, but somehow i lost my thought process and i have been getting error messages with the entry listed below.  My purpose is to have several txt fields would be 'hidden' or 'visible' if the checkbox is selected or unselected.  This is what i have an i would love some guidance on a command that would be useful for multiple fields at a time:

                     

                    This is what i have:

                     

                    (function () {

                     

                     

                        // Get a reference to the text field

                     

                       var f = getField("TEST_BOX");

                     

                     

                        // Show/Hide the text field based on the sate of this check box

                     

                        if (event.target.value === "Off") {

                     

                            getField("Address Line").display = display.visible;

                             

                            getField("Check Box1#0").display = display.visible;

                     

                        } else {

                     

                            getField("Address Line").display = display.hidden;

                     

                            getField("Check Box1#0").display = display.hidden;

                     

                        }

                     

                     

                    })();

                     

                    hope you can help.

                     

                    ~Los