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

I need help making an item list for multiple drop down fields to use

New Here ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

I have a form that uses first and last name to populate for training. I need to be able to make one item list for all the names that multiple lines can use. I wish to be able to update one list and have that update for all fields to use rather than update the first then change field names to match the first then change back . Any ideas?

TOPICS
PDF , PDF forms

Views

290

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 , Oct 16, 2024 Oct 16, 2024

Do you mean like a "master" field where you could update it and then copy those updates to the rest of the fields?

If so, you can do it using this code (you can run it from the JS Console or a button):

 

var items = [];
var masterField = this.getField("LastNameMaster");
for (var i=0; i<masterField.numItems; i++) {
	items.push([masterField.getItemAt(i, false), masterField.getItemAt(i, true)]);
}
for (var i=1; i<=26; i++) {
	this.getField("LastName"+i).setItems(items);
}

Votes

Translate

Translate
Community Expert ,
Oct 16, 2024 Oct 16, 2024

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 ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

Do you mean like a "master" field where you could update it and then copy those updates to the rest of the fields?

If so, you can do it using this code (you can run it from the JS Console or a button):

 

var items = [];
var masterField = this.getField("LastNameMaster");
for (var i=0; i<masterField.numItems; i++) {
	items.push([masterField.getItemAt(i, false), masterField.getItemAt(i, true)]);
}
for (var i=1; i<=26; i++) {
	this.getField("LastName"+i).setItems(items);
}

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
New Here ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

When I use that script it copies to every field down the line whatever is in the first field. I just need a master list that will change the other lists down the line but I can still select different information for each 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 Expert ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

Not sure what you mean. The script will copy the values from the master field to the others. The first item in the array is the default one, though. So if you want the fields to have an empty value make sure you add that to the master field as well.

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
New Here ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

When I use the script as you wrote it does nothing when I change the first field. Do I need to copy the script to all fields?

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
New Here ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

Or do I need to change the name of 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 Expert ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

@try67 's script sets all of the items in all of your dropdowns from LastName1 through LastName25, using another dropdown "LastNameMaster".  If you need to change the items in all the dropdowns you change them in LastNameMaster and run the script.  Is that not what you asked for?

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
New Here ,
Oct 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

I'm fairly new to this so forgive me if I don't follow well. What I would like to accomplish is say for last name 1. If you open properties and go to options there is an item list there. I can add an item as well as an export value. If I edit the item list in that field I would like that list to then propogate to all the last name fields lists as currently they are independent of one another and I would need to edit every item list individually as it is now.

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
New Here ,
Oct 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

LATEST

I'm sorry. I just figured out how to implement what you suggested. I was confused because when I run the script it fills in every field from 1-26 after running it. I just have to delete the fields out but the item list does in fact update.

 

Thank you for putting up with my lack of knowledge on this. I really appreciate the help.

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 ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

I created a (paid for) custom tool that lets you easily fill dropdowns with display values and export values by copy and pasting a column(s) from Excel if you're interested:

https://www.pdfautomationstation.com/products/item16.cfm

 

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