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?
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);
}
Copy link to clipboard
Copied
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);
}
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.
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.
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?
Copy link to clipboard
Copied
Or do I need to change the name of the first field?
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?
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.
Copy link to clipboard
Copied
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.
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