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

Dependent drop-down lists

Explorer ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

Hello everyone!

 

I need help with scripting.

 

I currently have two drop-down lists on my form, and I'm trying to set up the form in a way when User select either Create New, Deactivate, or Reactivate in the first drop-down list, the second drop-down list would automatically display N/A.  If the User select Modify, the second drop-down list would prompt User to choose between Role Change and User Update.

 

1st thuyviii_0-1590620942591.png          2nd    thuyviii_1-1590620962447.png

 

Would really appreciate your help.

 

Thank you!

TOPICS
PDF forms

Views

1.7K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , May 28, 2020 May 28, 2020

Then you can use this code as the custom Validation script of the first field (you didn't say what's the name of the other field, so I used "Dropdown2". Adjust it to the actual field name, of course):

 

if (event.value=="Create New" || event.value=="Deactivate" || event.value=="Reactivate") {
	this.getField("Dropdown2").setItems(["N/A"]);
} else this.getField("Dropdown2").setItems(["N/A", "Role Change", "User Update"]);

Votes

Translate

Translate
Community Expert ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

Do you mean that you want "N/A" to be selected in the second field, or that it should be the only possible option?

Votes

Translate

Translate

Report

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
Explorer ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

That should be the only possible option 

Votes

Translate

Translate

Report

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 ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

Then you can use this code as the custom Validation script of the first field (you didn't say what's the name of the other field, so I used "Dropdown2". Adjust it to the actual field name, of course):

 

if (event.value=="Create New" || event.value=="Deactivate" || event.value=="Reactivate") {
	this.getField("Dropdown2").setItems(["N/A"]);
} else this.getField("Dropdown2").setItems(["N/A", "Role Change", "User Update"]);

Votes

Translate

Translate

Report

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
Explorer ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

LATEST

Omg try67, you are the best!!!

I've been spending sooooo much time trying to figure this out on my own.  Thank you so much for your help!!!!

Votes

Translate

Translate

Report

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