Skip to main content
Inspiring
July 25, 2023
Question

How to export all values in the listbox (or better drop-down list)?

  • July 25, 2023
  • 1 reply
  • 941 views

Hi,

I need your help, please. I have attached a file for better understanding.

I have two lists: "Countries List" and "Selected Countries List." Users can add countries from the drop-down list to "Selected Countries List" to keep track of all the countries they have visited. However, when exporting the file, it only exports the selected values in the "Selected Countries List." I want to get all the countries that are in the "Selected Countries List" without having to select them one by one.

Can you please assist me with this?

Thank you!

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
July 26, 2023

What are you using to export the file?

Field data exports do not include list items, because they are not data, at least not in the traditional sense. If you want these items exported, then you'll need to add them to a text field. This could be a hidden text field. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
KaxkulAuthor
Inspiring
July 26, 2023

Thanks Thom,
I included a button to export to XFDF. I got what you mean, sorry to say but how to do so please?

Thom Parker
Community Expert
Community Expert
July 26, 2023

Add a text field to the form, set it's visibility property to  hidden. Then add code to the button that does the export to collect all the items in the list field into a CR/LF separated string and put that into the hidden field. Now all the seleted countries will be in the export data. 

 

BTW: the export code seems a little complex. There isn't any reason to collect all the fields. Acrobat will automatically export everything that isn't a button. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often