Skip navigation
Currently Being Moderated

Actions tab for form field properties

Jul 18, 2012 10:08 AM

 
Replies
  • Currently Being Moderated
    Jul 18, 2012 10:08 AM   in reply to Community Help

    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

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Jul 18, 2012 10:29 AM   in reply to Vadergod

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 1:15 PM   in reply to George Johnson

    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

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Jul 18, 2012 1:34 PM   in reply to Vadergod

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 2:18 PM   in reply to George Johnson

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 24, 2012 2:11 PM   in reply to George Johnson

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points