Skip to main content
Participating Frequently
April 2, 2025
Answered

Radio Button Changing Value of Dropdown

  • April 2, 2025
  • 1 reply
  • 316 views

So I'm trying to get these radio button to change the selection from a drop down menu.

 

The drop down menu is called "Golfers" and it has choices 0 - 8 with the export values of 0 = 0, 1 = 225, 2 = 450, 3 = 675, 4 = 900, etc. in intervals of 225 up to 8 = 1800.

 

The Radio Group is called "Sponsors" and has 3 choices under it;

"Deagle" has an export value of 4000

"Eagle" has an export value of 2000

and "Birdie" has an export value of 1000.


I need it so if "Deagle" is selected from the radio choices, I need the drop down to change to 8 (or export value 1800).

If "Eagle" is selected,  I need the drop down to change to 4 (or export value 900).

If "Birdie" is selected,  I need the drop down to change to 2 (or export value 450).

 

var golfersDropdown = this.getField("Golfers");

var sponsorsRadio = this.getField("Sponsors"); 

if (sponsorsRadio.value === "4000") { 
golfersDropdown.value = "900"; 


I thought this script might work for at least the Deagles section but it's not really helping out.

Correct answer PDF Automation Station

If using a mouse up action the field should be event.target like this:

 

var golfersDropdown = this.getField("Golfers");

var sponsorsRadio = event.target;

if (sponsorsRadio.value == 4000) {
golfersDropdown.value = 900;
}

1 reply

PDF Automation Station
Community Expert
April 2, 2025

Where did you put the script?  Remove the quotes from the numbers and remove one of the equals signs in the if statement like this:

var golfersDropdown = this.getField("Golfers");

var sponsorsRadio = this.getField("Sponsors"); 

if (sponsorsRadio.value == 4000) { 
golfersDropdown.value = 900; 

Participating Frequently
April 2, 2025

I'm putting it in the properties of the radio selections. Having it run a Java Script with the mouse up action

PDF Automation Station
Community Expert
April 2, 2025

If using a mouse up action the field should be event.target like this:

 

var golfersDropdown = this.getField("Golfers");

var sponsorsRadio = event.target;

if (sponsorsRadio.value == 4000) {
golfersDropdown.value = 900;
}