2 Replies Latest reply on May 29, 2014 3:13 AM by bruce00j

    How do I Show/Hide fields based on radio buttons?

    Hollyb Level 1

      I'm working on creating PDF Forms for our Health and Safety Program and am currently working on a form where I have a series of radio button groups (each contains a yes and no button) in a section that determines whether an additional form is required. I'm trying to make it so that when they click 'yes' to any of the options, a text field will appear explaining they must also attach a 'Critical Lift Checklist'. This Text Box must remain visible as long as any one of the radio button groups has 'yes' selected.

       

      I'm just starting to get into javascript, and I can't find any information on showing/hiding fields based on a series of radio button groups... is this even possible?

        • 1. Re: How do I Show/Hide fields based on radio buttons?
          nabnub Level 1

          have a look at this: http://acrobatusers.com/tutorials/print/js_disabling_fields

           

          it doesn't hide the fields but it disable them

          • 2. Re: How do I Show/Hide fields based on radio buttons?
            bruce00j Level 1

            I used this to hide and show icons (using buttons) but it can be used for other fields too

             

            Ill example it here:

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

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

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

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

             

            you would repeat this to alternate between showing something visible and hidden but from what I can gather you want a box to show if just one of the check boxes is yes and it would not matter on the response of others so what I would do is:

             

            Go to the radio button and press properties the go to actions.

             

            The trigger should be mouse up and the action should be run a javascript.

             

            now you would enter in that field

             

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

             

            now set the field that you want to be shown to hidden (Right Click>Properties>General>Form Field set to hidden)

             

            add this to all the yes check boxes this will make sure that what ever yes check box is ticked no matter what the outcome of the others it will always be displayed also replace "1" with your field name

             

            hope this helps!