简体   繁体   中英

Adobe Acrobat Pro - Get display value from dropdownlist?

I'm trying to read out both the "export value", and the text value that is displayed to the user of the form in adobe acrobat pro using javascript.

I can't seem to find documentation, or if there is any way to determine the value that is displayed if a value is specified in the "export value" field.

Example: DropDown with values: ("None", 0) ("Standard, 1) ("Premium", 2)

Then in my javascript, standard is selected:

this.getField("DDL").rawValue //returns undefined
this.getField("DDL").value //returns 1
this.getField("DDL").valueAsString //returns "1"

Is there a property that will return "Standard"?

This should do it... the getItemAt method with an additional parameter "bExportValue" of "false" will retrieve the display value for the dropdown at the current value.

var field = this.getField("DDL");
var selectedIndex = field.currentValueIndices;
var exportValue = field.getItemAt(selectedIndex); // The field value
var displayValue = field.getItemAt(selectedIndex, false); // Label shown in the UI
console.println(displayValue+": "+exportValue);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM