4 Replies Latest reply on Jun 25, 2014 1:01 PM by John Mensinger

    Creating a form with toggled sections

    Zombie Pixel

      So I know how to use a button action to hide and display forms in Indesign. What if it's not a form element though? What if it's a text box or graphic?

       

      I'm trying to create a PDF form with a tab menu where the user can click on one tab and the PDF will display one set of form fields while hiding the other set. Vise versa I want the opposite to happen with I click on another tab. I've seen that you can turn anything into a button and then it's available in the "Show/hide buttons and forms" button action but the problem I have is that I have form fields on top of other objects and when I convert those objects to buttons then I can't access the form field once I export the PDF. If anyone knows a way to make this work, that would be so awesome.

        • 2. Re: Creating a form with toggled sections
          Zombie Pixel Level 1

          Wow. Thanks Larry! That was the most helpful answer ever.

          • 3. Re: Creating a form with toggled sections
            Larry G. Schneider Adobe Community Professional & MVP

            The stuff you want cannot be exported directly from ID so you will have to do it in another software (Acrobat Pro).

            • 4. Re: Creating a form with toggled sections
              John Mensinger Adobe Community Professional & MVP

              I sense your sarcasm, but of course Larry's answer, un-detailed as it may be, is fundamentally correct.

               

              In Acrobat, you can use Javascript to show/hide buttons and fields, which is much more flexible than the basic functionality you get from the InDesign UI methods. If you're inexperienced with writing code, it might seem daunting at first, but once you find some examples (easy to find online), you really only need to copy/paste a few expressions, substituting your button/field labels for whatever pre-existing.

               

              Assuming you have the full version of Acrobat, here's something to get you started:

              With what you've already got...in InDesign...keep all your form fields as they are. Anything that's not a field, but that you will want to show/hide; make it a button...but don't set anything to show/hide...just export to PDF and get it all into Acrobat where you can manipulate it via Javascript. (You don't even need to have a final layout. Anything that's a field or button can be repositioned once you're in Acrobat.)

               

              In Acrobat, enter form edit mode and see the list of fields and buttons in your form. Choose the first click-able (button) item to use as a show/hide toggle, and access its properties (double-click or rt-click). Go to the Actions tab, select a trigger, (Mouse Up is most typical), and from the Select Action menu, choose Run a Javascript. Here, you could avoid Javascript and choose Show/Hide a Field, which will allow you to choose from a list. This also works, but is ultimately still somewhat limited, not unlike the InDesign features. To explore the Javascript possibilities, click the Add button to open the Javascript editor.

               

              Copy/paste this:

               

              this.getField("fieldName01").display = display.visible;

              this.getField("fieldName02").display = display.visible;

               

              etc., for all the elements you want to make visible, and this:

               

              this.getField("fieldName03").display = display.hidden;

              this.getField("fieldName04").display = display.hidden;

               

              etc., for all the elements you want to hide.

               

              Of course, it can go much deeper than this, but that's all there is to basic show/hide function via Javascript. It solves your immediate problem, and once you get past that, there are many more equally simple possibilities.