These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to "hide" formelements by selecting a spesific radiobutton

mikeyb
Registered: Sep 4 2011
Posts: 20
Answered

Hi all
 
I have two questions and hope someone can help me out.
 
QUESTION 1:
Is it possible to have two forms inside one PDF by some kind of hide function?
By that I mean one form is only visible at a time.
For example, you have two radio buttons:
 
O RadioA O RadioB
 
By selecting RadioA, a FORM A will appear, and by selecting RadioB, FORMB will appear.
 
Is this possible..?
  
QUESTION 2:
Is it possible to change the entries in a dropdown-box based on what radio button you select?
 
For example:
O RAD1 O RAD2
 
If you select RAD1, the dropdown-box will display: A, B, C
And if you select RAD2, the dropdown-box will display: F, G

My Product Information:
Acrobat Pro 10.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
The answer to both questions is yes (although you don't actually have two forms, you're just showing/hiding some of the fields in the same form).
The way to do it is like so: Let's say both radio buttons are called "Radio1" and the value of the first is "A" and of the second is "B". For each of them you add a MouseUp action that executes this JS code:
onChangeRadio1()

Now, you create a doc-level script with this general structure:

  1. function onChangeRadio1() {
  2. if (getField("Radio1").value=="A") {
  3. // show the A form fields
  4. // hide the B form fields
  5. // populate the drop-down with the A values
  6. } else if (getField("Radio1").value=="B") {
  7. // show the B form fields
  8. // hide the A form fields
  9. // populate the drop-down with the B values
  10. }
  11. }

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

mikeyb
Registered: Sep 4 2011
Posts: 20
You are great!