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

Import or copy list into dropdown list with export values

New Here ,
Apr 15, 2021 Apr 15, 2021

I have 100+ items along with unique export values I would like to add to a dropdown list. I've seen a few posts about pasting multiple items into a dropdown list, but I haven't found one that also inlcudes the Export Values.

Acrobat_Z1g5LYOEFM.pngexpand image

TOPICS
Create PDFs , Edit and convert PDFs , How to , PDF forms
1.3K
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 ,
Apr 15, 2021 Apr 15, 2021

You can find an example in the Acrobat Javascript Reference.

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 ,
Apr 15, 2021 Apr 15, 2021

You can try like this:

this.getField("Dropdown").setItems([["GEOG 101", "3"], ["GEOG 101L", "1"], ["GEOG 102", "3"]]);

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
Explorer ,
Feb 09, 2023 Feb 09, 2023

@Nesa Nurani is it also possible to force the setItems command to include leading zeroes on the export values? I know how to do this in other situations using 'valueAsString', but I can't figure out how to make that work when setting the dropdown items dynamically. For example, how would I adjust the below to ensure the export value included the leading zeroes?

var dropDownVal = [["one", 01], ["two", 02], ["three", 03]];
var field = this.getField("Numbers");
field.setItems(dropDownVal);



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 ,
Feb 09, 2023 Feb 09, 2023

E.g. replace 01 with "01"

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
Explorer ,
Feb 09, 2023 Feb 09, 2023
LATEST

Wow, that is so easy I hadn't even considered it. Thank you, @Bernd Alheit !

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 ,
Apr 16, 2021 Apr 16, 2021

As mentioned, this can be done using the setItems method, by specifying an array of arrays as the input parameter.

Note that the first item in the array is the default one.

 

If you're interested, I've developed a paid-for tool that allows you to do it directly from a text file, including importing export values, easily and quickly. You can find it here: https://www.try67.com/tool/acrobat-import-items-from-a-text-file-to-a-combo-box-or-list-field

 

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