Skip to main content
kevink28174977
Participant
May 6, 2020
Answered

Dropdown list: Select Item, but display Export Value

  • May 6, 2020
  • 3 replies
  • 2466 views

Hi all, 

I'm trying to generate a dropdown menu, "Dropdown1," and have the selected displayed Item generate the Export Value instead of the Item itself. What would be the javascript and do I add this within the Actions or Calculate tab?

General-->Name: "Dropdown1"

Options-->
Item: Instructor Led Training
Export Value: ILT

Item: Computer Based Training
Export Value: CBT

Thanks in advance, 

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

No, it cannot be done from the Actions or Calculate tab. It can only be done from a custom Format event. Using the code that ls_rbls posted. 

3 replies

Participant
August 7, 2020

I've tried this code but it doesn't seem to be working for me. Unless I'm not understanding the post and replies correctly. Let's say I have a list of the 50 states spelled out in the Items List, and when I select "Texas" I would like for it to show "TX" in the same list box.

 

Does the code mentioned here work for this?

ls_rbls
Community Expert
Community Expert
August 7, 2020

Place the script in the custom format script section. See slide:

 

 

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
May 7, 2020

No, it cannot be done from the Actions or Calculate tab. It can only be done from a custom Format event. Using the code that ls_rbls posted. 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
kevink28174977
Participant
May 7, 2020

thank you both, this worked!

ls_rbls
Community Expert
Community Expert
May 7, 2020

Hi, 

 

This has been answered before.

 

Use this line of code:

 

event.value = event.target.getItemAt(event.target.currentValueIndices, true);

 

Answered by George_Johnson back in 2016: https://community.adobe.com/t5/acrobat/display-export-value-of-dropdown-instead-of-item/td-p/7936974?page=1

 

Participant
June 9, 2020

I am new to all of this.

 

Do I have to enter any specific words in the line of code?

event.value = event.target.getItemAt(event.target.currentValueIndices, true);

 

General - Employee

 

Item - Name 1

Export - 2121

 

Item - Name 2

Export - 3131