Skip navigation
Theresa1214
Currently Being Moderated

Radio buttons with dropdowns?

Apr 12, 2012 8:00 PM

Tags: #acrobat_forms #acrobat_9_pro #acrobat_10_pro #radio_buttons #dropdowns

I'm creating a form for my company's HR department, and I need some radio buttons with dependent dropdowns.

 

In other words, I'd like (for example) three radio buttons. No dropdowns appear until one of the buttons is selected, and then the appropriate dropdown appears. Is this possible? Or is there a better way to do this? I don't want the unselected dropdowns to be available.

 

I have Pro 9 for Windows and Pro X for Mac. I know virtually nothing about scripting, but I know that it can be done.

 

Thanks in advance for any help!

 

Theresa

 
Replies
  • Currently Being Moderated
    Apr 13, 2012 12:37 AM   in reply to Theresa1214

    You need to associate scripts with the radio-buttons that check their current value and show/hide the drop-downs based on it.

    Use the MouseUp-action. For example, if the radio-group is called "Radio1" and it has the values 1, 2, and 3 and you want to show "Combo1" if 1 is selected, "Combo2" if 2 is selected, etc., use this code as the MouseUp action:

     

    Radio1MouseUp()

     

    And then embed this code at the doc-level:

     

    function Radio1MouseUp() {

    var v = this.getField("Radio1").value;

    this.getField("Combo1").display = (v=="1") ? display.visible : display.hidden;

    this.getField("Combo2").display = (v=="2") ? display.visible : display.hidden;

    this.getField("Combo3").display = (v=="3") ? display.visible : display.hidden;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2012 2:29 PM   in reply to Theresa1214

    Do I add this code to the group's action, or to individual radio button actions?

    To each individual radio-button.

     

     

    Do I make the dropdowns visible or hidden?

    Their visibility will be determined by the state of the radio-buttons. As default you can set them to be hidden, when no radio button is selected.

     

     

    Do I put any code in the dropdown properties, or just in the radio button properties?

    Just in the radio buttons.

     

     

    And when you say "embed this code at the doc-level," what does that mean?

    Go to Advanced - Document Processing - Document JavaScripts...

    Create a new script, remove the default text that appears in the window and paste the code I provided instead.

     
    |
    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