Skip to main content
Participant
April 19, 2018
Answered

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

  • April 19, 2018
  • 1 reply
  • 3053 views

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.

This topic has been closed for replies.
Correct answer Thom Parker

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

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
April 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, 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 PDFScriptingUse the Acrobat JavaScript Reference early and often