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

Acrobat - Multiple Dropdowns, Same Data/Items - Edit Items in One Place - How?

Explorer ,
Mar 24, 2023 Mar 24, 2023

Hello,

I have a form that contains 33 dropdowns all with the same names of people in it. I would like to be able to edit the names listed in each dropdown, all in one place. Currently when I want to add or delete a name, I have to do it indiviudally in each dropdown and its time consuming and frustrating and often times I push it off when it shouldn't be. I have never done script before but if someone can point me in the right direction on how to do this and accomplish it, it woul be greatly appreciated. The form is used by my volunteer fire company to complete their reports when they respond on a call. I included a copy of the form. 

TOPICS
How to , JavaScript , PDF forms
3.1K
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
Explorer ,
Mar 24, 2023 Mar 24, 2023

I would create a hidden field and define a variable in that field that contains all the names in your list.

For example, you want a list with the names Josh, Amy and Susan. Put this in the calculation script of a hidden field:  var list = ["Josh", "Amy", "Susan"]. Put this in the calculation script of your drop-downs: event.target.setItems(list). This way, your dropwdown items will be set to that list and when you change the list, the items dropdown items will change too. 

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

Edit one dropdown

Create multiple copies of this dropdown

 

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

Unfortunately that isn't an option. We dropdown needs to be updated every month or two. If we make multiple copies, then I am spending time fixing tab orders.

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

I would create a hidden field and define a variable in that field that contains all the names in your list.

For example, you want a list with the names Josh, Amy and Susan. Put this in the calculation script of a hidden field:  var list = ["Josh", "Amy", "Susan"]. Put this in the calculation script of your drop-downs: event.target.setItems(list). This way, your dropwdown items will be set to that list and when you change the list, the items dropdown items will change too. 

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

Also, if you want to set the value of your dropwdown when the user is not selecting an option, put this in in your calculation script of the dropwdown field: event.value = "whatever you want to set it to". For example, I want my dropdown to display select: event.value = "select".

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

Thank you so much! I am able to see the hidden list, however when I click off of that dropdown to go to the next field, it changes back to the first entry on the dropdown list. I'm sure its something simple I'm missing. 

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

Instead of setting the value of the dropwdown by using event.value, which I stated above, I would put the value you want the user to see at the start of the list. For example, var list = ["[select]","one", "two"]. This will show [select] if the user hasn't selected a name.

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
Explorer ,
Mar 24, 2023 Mar 24, 2023

Sorry, maybe I'm not explaining it right. When I make a selection in the dropdown list that the custom script calculation is inserted in, it doesn't save/lock in the selection. It defaults back to the first entry on the list. I attached a copy of the PDF. The field I am testing is at the immediate top of the first page. 

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 ,
Mar 24, 2023 Mar 24, 2023
LATEST

That's because you're using the Calculation event to run the code. There's no need to do it. Use a button to update the lists, or even the Validation event of the text field. A Calculation script executes each time the value of any field in the file is edited.

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