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

Change multiple dropdown menus based on value of first dropdown

Community Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

I have four dropdown menus. "Name", "Title", "Competency", "Number". What I want to do is to have the values in the last three to change based on which "Name" I select. I have tried just about every code and script I could find but doesn't seem to work with the newest version of Acrobat Pro DC. Thank you.

TOPICS
Edit and convert PDFs , How to , JavaScript , PDF forms

Views

3.9K

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 , Mar 07, 2023 Mar 07, 2023

As 'validation' script of "Name" field use this:

var d1 = this.getField("Title");
var d2 = this.getField("Competency");
var d3 = this.getField("Number");

if(event.value == "Name 1"){
d1.setItems(["Title1","Title2"]);
d2.setItems(["Competency1","Competency2"]);
d3.setItems(["Number1","Number2"]);}

else if(event.value == "Name 2"){
d1.setItems(["Title3","Title4"]);
d2.setItems(["Competency3","Competency4"]);
d3.setItems(["Number3","Number4"]);}

else{
d1.clearItems();
d2.clearItems();
d3.clearIt
...

Votes

Translate

Translate
Community Expert ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

https://acrobatusers.com/tutorials/js_list_combo_livecycle/

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

I'm sorry, but none of that makes any sense. Can you please explain in Crayon? I need this dumbed down... a lot.

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 ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

As 'validation' script of "Name" field use this:

var d1 = this.getField("Title");
var d2 = this.getField("Competency");
var d3 = this.getField("Number");

if(event.value == "Name 1"){
d1.setItems(["Title1","Title2"]);
d2.setItems(["Competency1","Competency2"]);
d3.setItems(["Number1","Number2"]);}

else if(event.value == "Name 2"){
d1.setItems(["Title3","Title4"]);
d2.setItems(["Competency3","Competency4"]);
d3.setItems(["Number3","Number4"]);}

else{
d1.clearItems();
d2.clearItems();
d3.clearItems();}

Just change items to what you need them to be and add more 'else if' conditions (before last 'else') if needed.

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

So, I put this in the custom validation script in the "Name" dropdown. Do I put the actual name in the script, and the "Title" I want associated with it, so on, etc.? I am really bad at this. Nothing is working.

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

I figured it out. My dropdown titles didn't match the code. All good now. Thank you so much.

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

I want the same effect for the dropdown menu but I don't work.


I got two dropdown called "d" and "e" which both of them contain three options in it.

And I want to show the "e" option based on the options in "d" menu

 

 

 

726EFA4A-D9E0-4769-BC91-E00418C212CB.jpeg

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

It also doesn't work if I use this script 

 

33F2B992-5E4D-4235-AE20-08D8F5962A42.jpeg

 

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 ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

In the first photo, you are missing the second curly bracket at the 'else' part.

In the second photo, you are missing the quote at 'Item 3'.

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

It also doesn't work. Can you do the corrections for me?

 

that When I select option "a" on drop down list called "drop1",  another drop down list "drop2" will automatically appear option "b".

 

There are three options in each dropdown 

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 ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

Use this as validation script of "drop1" field:

var d2 = this.getField("drop2");
if(event.value == "a")
d2.setItems(["a1"]);
else if(event.value == "b")
d2.setItems(["b1"]);
else if(event.value == "c")
d2.setItems(["c1"]);
else
d2.clearItems();

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

I have applied this.

However, after I select from drop1, all the options from drop2 are disappeared 

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

image.jpg

 

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 ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

Is field name "e" or "drop2"?

Can you share file?

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 Beginner ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

538F3398-3248-4ACD-AC55-FB93A4097CBB.jpeg

C8B4D284-236F-49B8-B0D1-74128D78554C.jpeg

  

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 ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

What is the issue exactly?

Did you use script as validation or calculation?

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

  

after I select from the left dropdown, the options of right drop down disappeared.

6F1E44CF-87A1-475D-BE1D-B98766D72C8B.jpeg

00A7A1FA-7E2A-4C1F-B98F-E408B3FD54CF.jpeg

 

75840833-5F3A-42AB-8E56-59ADA05A69EE.jpeg

 

 

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 ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Use script as 'Validate'.

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

 I applied here

08F6CEAD-7FEF-47ED-9750-173BD6354B2B.jpeg

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 ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Then please share your file with us.

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Try the atachment.

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

LATEST

Tick the box that says "Commit selected value immediately" (under Properties - Options) and it will change as soon as you make a selection in the first field.

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

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