Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Initialize Drop List


Level 2
I have a drop list that is being populated from a database. I also have a record in the database that holds a value (the hidden text value in the drop list) that could indicate which item in the droplist should be selected. Since the value in the database is not always up-to-date I want to initialize the drop list with this value, but allow the user to make an alternate selection if it is not correct. Is it possible to initialize a drop list?
2 Replies


Level 5
Following FormCalc code may help you. rawValue porperty sets the default selection. For the following example 'Xyz' gets displayed after loading all the values. And user can change the selection form there. Hope this helps.

xfa.form.form1.Section41SF.DropDownList1.clearItems()xfa.form.form1.Section41SF.DropDownList1.addItem("Abc", 1)xfa.form.form1.Section41SF.DropDownList1.addItem("Xyz", 2)

xfa.form.form1.Section41SF.DropDownList1.addItem("Lmn", 3)

xfa.form.form1.Section41SF.DropDownList1.rawValue = 2



Not applicable
I would simply bind the record which contains the initial selection of the drop down list to an invisible text field on your form and then add a line of script to the end of your drop down list's initialization script (which, I presume, is populating the list from the database) which sets the value of the drop down list to the value of this invisible text field (in JavaScript):

this.rawValue = InitialDropDownListSelection.rawValue;

Of course, this assumes that the InitialDropDownListSelection field's value is the same type of value which is assigned to each individual item in your drop down list.

I've attached a sample form (zipped along with a data file) which contains a drop down list initialized from records in an XML Data File. The default selection in this drop down list is based on the value of an invisible text field which is bound to a specific data node in the same XML Data File. While this isn't working from a data base, the principal is the same. If you open the form in Acrobat (instead of previewing it from Designer 7.1), remember to import the data into the form after you've opened it.


Adobe Systems