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

Populating Combo Boxes

bigal980
Registered: Nov 30 2009
Posts: 5
Answered

Hello, I'm having a rather hard time figuring something out. I know how to fill in a text field using values selected from a Combo Box, but how do you do the reverse?

I have Text Fields A, B, and C, and I want the values placed into those text fields, to be used to populate a Combo Box. So if you put "John" into Text field A, "Mark" into Text field B, and "Sue" into Text field C, the Combo Box will populate like this:
"John"
"Mark"
"Sue"

And if you change "John" to "Bill", the new Combo Box items will be re-populated to:
"Bill"
"Mark"
"Sue"

Any help on the matter would be greatly appreciated.

My Product Information:
Acrobat Pro 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Have a look in the documentation at the setItems method of the Fields object.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

bigal980
Registered: Nov 30 2009
Posts: 5
Thanks try67. After looking into the setItems function, I figured out how to do it. Here is an example code snipet in case anyone else comes across the same issue. In this example you take whatever values are in two field boxes("TextBoxA" and TextBoxB"), and use those to populate your combo box with the name "ComboBox":

var l = this.getField("ComboBox");
l.setItems([this.getField("TextBoxA").value, this.getField("TextBoxB").value])