Copy link to clipboard
Copied
I have a form that has the same dropdown list on every line (over 50 of them). If I need to change an item in the list, my only option is to edit each list on every single line. Changes happen frequently. Is there really no way to have one field/list that can be the source of my dropdown lists?
Copy link to clipboard
Copied
Sure you can. I would do it using a (hidden) button somewhere in the vicinity of the "master" list. Say that list is called "Dropdown1" and the others are "Dropdown2" to "Dropdown50". Add a button with this code next to the first field:
var f = this.getField("Dropdown1");
var items = [];
for (var i=0; i<f.numItems; i++) {
items.push(f.getItemAt(i));
}
for (var i=2; i<=50; i++) {
this.getField("Dropdown"+i).setItems(items);
}
Update the first field's items, then click the button to update the rest of them.
Just be aware that updating the lists will clear any selections you made in any of these fields.
Copy link to clipboard
Copied
You can put list as document level JavaScript that will populate all fields.
Copy link to clipboard
Copied
Just be aware it will reset the current selection each time it runs, so you would need to save that value first and then re-apply it later on.
Copy link to clipboard
Copied
Sure you can. I would do it using a (hidden) button somewhere in the vicinity of the "master" list. Say that list is called "Dropdown1" and the others are "Dropdown2" to "Dropdown50". Add a button with this code next to the first field:
var f = this.getField("Dropdown1");
var items = [];
for (var i=0; i<f.numItems; i++) {
items.push(f.getItemAt(i));
}
for (var i=2; i<=50; i++) {
this.getField("Dropdown"+i).setItems(items);
}
Update the first field's items, then click the button to update the rest of them.
Just be aware that updating the lists will clear any selections you made in any of these fields.
Copy link to clipboard
Copied
This seems to be working, but it is only copying to Dropdown2. Is something missing to get it to continue to copy to 3-50? I have copied and pasted the script exactly with no changes.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now