Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Radio Button Changing Value of Dropdown

Community Beginner ,
Apr 02, 2025 Apr 02, 2025

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.

TOPICS
JavaScript , Modern Acrobat , PDF , PDF forms
94
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 02, 2025 Apr 02, 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; 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 02, 2025 Apr 02, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 02, 2025 Apr 02, 2025
LATEST

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines