Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Populate drop-down list from multiple text fields.

Avatar

Former Community Member
Just to begin, I am brand new to this application and brand new to coding in general. Anyways, this is what I am trying to accomplish. I need to populate a drop-down list from multiple text fields. I am able to populate one item using this in the calculate event:



TextField1.rawValue



After I type text in TextField1 and hit enter, it displays the text in the drop-down list. I need to do this but with more than just one text field to populate more options for the drop-down list. I will also need to do something similar with populating a drop-down list from selections made in multiple other drop-down lists.



Thanks for any help you can give me.
5 Replies

Avatar

Level 7
Instead of just setting the value, have you looked at ".addItem(.....)" method to add an item to the drop-down list.

Avatar

Former Community Member
Thank you for your suggestion Geo Kaiser. With that, I was able to populate my drop-down lists, but now when I select an option from the drop-down list, the selection dissapears. The selection will appear briefly in the box but then dissapears although my drop-down list options remain there. Here is the code I am using for my text field to drop-down list:



DropDownList1.clearItems()

DropDownList1.addItem(TextField1)

DropDownList1.addItem(TextField2)



And here is my code for my drop-down list to populate another drop-down list:



DropDownList3.clearItems()

DropDownList3.addItem(DropDownList1)

DropDownList3.additem(DropDownList2)



Thanks again for your help. By the way, I am using Adobe Designer 7.0.

Avatar

Former Community Member
Nevermind that last message. I put my code in the enter event and now everything is working great. Thanks for the help.

Avatar

Level 1

Hello Brock.  I know this is an old post but I am trying to do this in adobe acrobat pro dc.  The basic idea of what I am trying to do is this:

I have a form where I input artist names in a text field.  From there I want to have those names be added to a dropdown list from there I can select which artist I want assigned to a project.  I am new to java in acrobat and hope this is still possible.  Any help would be great.  I have been trying to put in the above info but with no luck.

Avatar

Level 6

Create a text field and name it Artist1

Create a second text field and name it Artist2

etc.

create a drop down list and name it artists

add the following java script to your droplist using the preOpen event:

this.rawValue = null;

this.clearItems();

this.addItem(Artist1.rawValue);

this.addItem(Artist2.rawValue);


Copy the droplist for each instance where you want to use it