How to Reference Dropdown List "Item" value vs "Export Value"?

New Here ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

How can I reference a field's "Item" value of a dropdown selection, instead of its "Export Value?"

I have multiple items with the same export value but I need to reference the "Item" value.

For example...

Item: "Included", Export Value: 0

Item: "Excluded", Export Value: 0

Item: "$1000", Export Value: 1000

Since the export values of 2 of the items are the same, I need to reference the "Item" value.

I'd also like to populate another form field with the selected item's "Item" value.

TOPICS
Create PDFs

Views

1.5K

Likes

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 , Apr 19, 2018 Apr 19, 2018

Acrobat doesn't stop you have entering the same Export value for two entries, but they really should be unique.

Regardless, you can acquire the display value with the "field.getItemAt()" function. Get the index from the "field.currentValueIndicies" property. 

However, if you are acquiring values during the format or validate event, the display value is in "event.value". Use this if you're using these events. In the Keystroke event the display value of the newly selected item is in event.change,

...

Likes

Translate

Translate
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

LATEST

Acrobat doesn't stop you have entering the same Export value for two entries, but they really should be unique.

Regardless, you can acquire the display value with the "field.getItemAt()" function. Get the index from the "field.currentValueIndicies" property. 

However, if you are acquiring values during the format or validate event, the display value is in "event.value". Use this if you're using these events. In the Keystroke event the display value of the newly selected item is in event.change, and the  export value is in event.changeEx.

Here's an article on changing another field with a dropdown selection.

https://acrobatusers.com/tutorials/change_another_field

And here's more on using lists and dropdowns.

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

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

Likes

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