How to get a combobox value name, not the export name
i want copy item name combo list , display selection in field text, got export value , not value name, ideas? attention.
i have created combo box in document javascript:
var l = this.getfield("brandlist");
l.setitems([["item list"],["item 1","b010"],["item 2","b020"],["item 3","b030"],["item 4","b040"],[" "]]);
l.readonly = false;
l.defaultvalue = [item list"];
l.editable = false;
now, want display slected item name ("item 1", "item 2", etc) in field, have tried code in text field properties>calculate, want item name appears, got export value, e.g. "b010", "b020", etc.
getfield("newfield").value = getfield("brandlist").valueasstring;
first index of selected item: http://livedocs.adobe.com/acrobat_sdk/11/acrobat11_htmlhelp/js_api_acrojs.89.701.html
then use item name (aka "face value"): http://livedocs.adobe.com/acrobat_sdk/11/acrobat11_htmlhelp/js_api_acrojs.89.752.html
for example:
var f = getfield("combo1");
var idx = f.currentvalueindices;
var fv = f.getitemat(idx, false);
app.alert(fv);
More discussions in JavaScript
adobe
Comments
Post a Comment