Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Edit one dropdown
Create multiple copies of this dropdown
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now