Skip to main content
Participating Frequently
Apr 2, 2025 2:32 PM UTC
Answered

Radio Button Changing Value of Dropdown

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.

PDF Automation Station
Community Expert
Apr 2, 2025 4:35 PM UTC

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;
}

3 replies

PDF Automation Station
Community Expert
Community Expert
Apr 2, 2025 3:21 PM UTC

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; 
} 

Translate
Participating Frequently
Apr 2, 2025 3:48 PM UTC

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

Translate
PDF Automation Station
Community Expert
Community Expert
Apr 2, 2025 4:35 PM UTC

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;
}

Translate