Skip to main content
Known Participant
January 21, 2016
Resuelto

Display Export Value of dropdown instead of Item

  • January 21, 2016
  • 1 respuesta
  • 8165 visualizaciones

I'm trying to show the Export Value of a dropdown instead of the selected option i.e. the user selects BLACK but the export value of BLK is actually displayed.  I can find lots of discussions on how to pull the export value and display it or use it to trigger another response in another field and I can usually tweak my existing JavaScripts when I need something new but I cannot seem to wrap my head around this!

This is my latest (failed) attempt

var f = this.getField("eyes");

if (event.value == "Black - BLK")

f.value = "BLK"

I'm using Acrobat PRO DC.

Any help is appreciated,

Thanks

Meabh


Este tema ha sido cerrado para respuestas.
Mejor respuesta de George_Johnson

I've been doing this a long time, and have never heard of anyone wanting something like this, so it's interesting. Remove your current script and try the following as the custom Format script of the eyes dropdown:

// Custom Format script for dropdown

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

This sets what's displayed in the dropdown to the export value of the selected item. Select the "Commit selected value immediately" option for the dropdown for the smoothest operation.

1 respuesta

Inspiring
January 21, 2016

Where did you place that script? What field and what event?

Known Participant
January 21, 2016

In the Custom Calculation Script of the "eyes" dropdown field.  I'm trying to get the Export Value to display in the dropdown field, not in a separate field. I can only assume I'm making this harder than it needs to be.

Meabh

Known Participant
May 12, 2019

I've been doing this a long time, and have never heard of anyone wanting something like this, so it's interesting. Remove your current script and try the following as the custom Format script of the eyes dropdown:

// Custom Format script for dropdown

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

This sets what's displayed in the dropdown to the export value of the selected item. Select the "Commit selected value immediately" option for the dropdown for the smoothest operation.


I am so glad I found this thread.  I did it exactly as its suggested and it works perfectly but unfortunately only in the editor Acrobat PRO DC.  I saved it and sent it to myself and it does not work in the browser or in Acrobat Reader.
Am I doing something wrong or can this not work in the way I need?