Skip to main content
Josh_Lauder
Participating Frequently
December 17, 2017
Answered

Have a radio button checked based on a selection of an item from a dropdown list

  • December 17, 2017
  • 1 reply
  • 630 views

Hi,

I have a dropdown list and a group of radio buttons on my form.

I need that the appropriate radio button should get automatically checked based on the selection of an item from a dropdown list.

For example,

If Item 1 is selected than radiobtn1 should be checked and if Item 2 is selected than radioBtn2 should get checked.

This topic has been closed for replies.
Correct answer Thom Parker

This article covers the basic principle of changing a form field from a dropdown and will get you started:

https://acrobatusers.com/tutorials/change_another_field

However, the example is changing a set of text fields from the combo selection.  Radio buttons are a little different, but not much.  A radio button is turned on when the value of the Radio Button Group is set to the export value of a specific button.

So if you make the export values for the list the same as the export values for the radio buttons, then you can use this code in the Keystroke Script for the combobox

if(!event.willCommit)

     this.getField("RadioGroup").value = event.changeEx;

The "RadioGroup" needs to be changed to the name of your radio button group

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 17, 2017

This article covers the basic principle of changing a form field from a dropdown and will get you started:

https://acrobatusers.com/tutorials/change_another_field

However, the example is changing a set of text fields from the combo selection.  Radio buttons are a little different, but not much.  A radio button is turned on when the value of the Radio Button Group is set to the export value of a specific button.

So if you make the export values for the list the same as the export values for the radio buttons, then you can use this code in the Keystroke Script for the combobox

if(!event.willCommit)

     this.getField("RadioGroup").value = event.changeEx;

The "RadioGroup" needs to be changed to the name of your radio button group

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Josh_Lauder
Participating Frequently
December 18, 2017

Was very helpful.

It took me a while, though, to figure out how to make the export values of the Radio buttons the same as the export values of the list. But got it in the end.

Thanks