Skip to main content
New Participant
February 12, 2022
Answered

Select radio button based on drop-down selection

  • February 12, 2022
  • 1 reply
  • 2221 views

Hi.  I'm a true beginner with script in Adobe forms so I'm hoping someone can help.  I'm designing a form for in-processing (on-boarding) new employees and am trying to get radio buttons to select N/A based on the employee type.  Certain employee types don't need to in-process all sections or areas within a section, which is why I want to fill N/A when selected.

 

The other radio buttons are "Yes" and "No", with "No" being the default, until they've in-processed something. 

 

I've tried to figure this out on my own but am not getting anywhere so I appreciate any help.

This topic has been closed for replies.
Correct answer Nesa Nurani

Move your script to validation and use radio button group field name not their choices, something like this:

if (event.target.value=="Military") {
this.getField("Group1").value = "NA1";

There is no "Military" and "Civilian" in dropdown as choices.

Also you can't use "" for radio button to set it to default, I belive you want it to set to N/A then you should use "NA1".

Try using this script as 'Validation' of dropdown field and in dropdown field -> options tab check 'Commit selected value immediately' this is important to do.

Here is script:

if(event.value=="Military")
this.getField("Group1").value = "NA1";
else if (event.value=="Civilian")
this.getField("Group1").value = "Yes1";
else
this.getField("Group1").value = "No1";

Here is also your files with changes already made, let me know if it needs to change anything (I added "Military" and "Civilian" to dropdown for example purpose:

https://drive.google.com/uc?export=download&id=1pI3MolSLEu2aWIKh3omc0Olh_kpeiljk 

 

1 reply

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
February 12, 2022

Move your script to validation and use radio button group field name not their choices, something like this:

if (event.target.value=="Military") {
this.getField("Group1").value = "NA1";

There is no "Military" and "Civilian" in dropdown as choices.

Also you can't use "" for radio button to set it to default, I belive you want it to set to N/A then you should use "NA1".

Try using this script as 'Validation' of dropdown field and in dropdown field -> options tab check 'Commit selected value immediately' this is important to do.

Here is script:

if(event.value=="Military")
this.getField("Group1").value = "NA1";
else if (event.value=="Civilian")
this.getField("Group1").value = "Yes1";
else
this.getField("Group1").value = "No1";

Here is also your files with changes already made, let me know if it needs to change anything (I added "Military" and "Civilian" to dropdown for example purpose:

https://drive.google.com/uc?export=download&id=1pI3MolSLEu2aWIKh3omc0Olh_kpeiljk 

 

Apaka586Author
New Participant
February 13, 2022

Nesa,

Thank you so much.  I know I had a rough draft, but your script was very helpful.  I'm able to start building out my form from here.

 

Thank you again for the help.