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

Master Dropdown Listing

Community Beginner ,
Jun 21, 2024 Jun 21, 2024

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?

TOPICS
PDF forms
718
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
Community Expert ,
Jun 21, 2024 Jun 21, 2024

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.

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 ,
Jun 21, 2024 Jun 21, 2024

You can put list as document level JavaScript that will populate all fields.

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 ,
Jun 21, 2024 Jun 21, 2024

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.

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 ,
Jun 21, 2024 Jun 21, 2024

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.

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 Beginner ,
Jun 26, 2024 Jun 26, 2024
LATEST

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. 

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