These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Combobox and Export-Value

medi
Registered: Jun 17 2009
Posts: 12

My problem might be easily solved, but I did'nt get rid of it, sorry.
 
How can I get the export-value of a combobox?
getField("combobox").value does not deliver the export-value.
What have i to do?
 
Thank you for your support!

My Product Information:
Acrobat 8.2.6, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
It depends on the event that's triggering the code. Exactly where did you place the code and what is it attempting to do?
medi
Registered: Jun 17 2009
Posts: 12
I filled a combobox, for example with this code:

------------
fieldname = "combofieldname";
f=getField(fieldname);
f.setItems([["Name1", "0"],["Name2","1"],["Name3","2"]]);
------------

then the user selects, e.g. the second entry.

the validation-script
------------
var fieldvalue = this.event.value;
console.println("fieldvalue: " + fieldvalue);
------------
shows "Name2"

but when calling

console.println(getField("combofieldname").value);

I get the right value, "1"

So, I see, they are different events. But how could I get the exportvalue in the validation-script?

(And why are there different values, depending on the event???)








George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
For lack of a better explanation, that's just the way it is. To get the export value of a combo box when it is selected, place the code in the Keystroke event and get the the event.valueEx property. For example:

  1. if (!event.willCommit) {
  2. app.alert(event.changeEx);
  3. }
For the relevant documentation, see: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.607.phpAnd for a great series of articles on the Acrobat JavaScript event model, see: http://www.math.uakron.edu/~dpstory/pdfblog.php
medi
Registered: Jun 17 2009
Posts: 12
Oh, thank you, George!
It works!
And I have learnt, that one has the opportunity to define the user-keyboard-script in the "format"-section...

Greetings!

Dieter