简体   繁体   English

Adobe Acrobat Pro - 从下拉列表中获取显示值?

[英]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.我正在尝试使用 javascript 在 adobe acrobat pro 中读取“导出值”和向表单用户显示的文本值。

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)示例:下拉菜单的值: ("None", 0) ("Standard, 1) ("Premium", 2)

Then in my javascript, standard is selected:然后在我的 javascript 中,选择了标准:

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.这应该这样做......带有附加参数“bExportValue”的“false”的getItemAt方法将检索当前值的下拉列表的显示值。

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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