Copy link to clipboard
Copied
I want to use a drop down list on a form. The list could have many entries. So far the only way I have found to populate the list is the one at a time entry in Properties. Painful. Is there an easier way to do this?
You can put this code in a button as Mouse UP event, and then when clicked it will populate dropdown field with choices.
Add more choices as sees fit.
If you don't need export values, remove that part from code.
this.getField("Dropdown1").setItems([["Option1", "Export value1"], ["Option2", "Export value2"]]);
Copy link to clipboard
Copied
You can set the items with a Javascript script.
Copy link to clipboard
Copied
You can put this code in a button as Mouse UP event, and then when clicked it will populate dropdown field with choices.
Add more choices as sees fit.
If you don't need export values, remove that part from code.
this.getField("Dropdown1").setItems([["Option1", "Export value1"], ["Option2", "Export value2"]]);
Copy link to clipboard
Copied
I see. The "setItems" is what I was looking for. Thank You.
Copy link to clipboard
Copied
Can I push the envelope a bit, is there something like "addItem"?
Copy link to clipboard
Copied
You can use the method "insertItemAt"
Copy link to clipboard
Copied
That worked. Thank you.
Copy link to clipboard
Copied
If you have the list of items in a text file you can use a script to read the contents of that file directly and then import them into the drop-down field.
I've developed a (paid-for) script that does just that. You can find it here: https://www.try67.com/tool/acrobat-import-items-from-a-text-file-to-a-combo-box-or-list-field