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

Select radio button based on drop-down selection

New Here ,
Feb 12, 2022 Feb 12, 2022

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.

TOPICS
How to , JavaScript , PDF forms
2.2K
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
1 ACCEPTED SOLUTION
Community Expert ,
Feb 12, 2022 Feb 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 

 

View solution in original post

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 ,
Feb 12, 2022 Feb 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 

 

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
New Here ,
Feb 12, 2022 Feb 12, 2022
LATEST

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.

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