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

SOLVED

Populating dropdown list from textfields

Avatar

Level 1

Greetings:

I cannot get this to work.

I am trying to populate a dropdown list with responses contained in several textfields.

I have tried

".addItem(textfield1)

.addItem(textfield2)"

That returns "empty" and repeats the  textfields' values.

Help is appreicated. Thank you.

Steven

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The syntax for JavaScript in the preOpen event of the dropdown would be:

this.addItem(textfield1.rawValue);

But you would also want to include script to clear the items first, otherwise the items on the dropdown would multiply everytime it is opened:

this.rawValue = null;

this.clearItems();

this.addItem(textfield1.rawValue);

this.addItem(textfield2.rawValue);

You can see this type of script in action here: http://assure.ly/jcTahK and here: http://assure.ly/gcXx03.

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

The syntax for JavaScript in the preOpen event of the dropdown would be:

this.addItem(textfield1.rawValue);

But you would also want to include script to clear the items first, otherwise the items on the dropdown would multiply everytime it is opened:

this.rawValue = null;

this.clearItems();

this.addItem(textfield1.rawValue);

this.addItem(textfield2.rawValue);

You can see this type of script in action here: http://assure.ly/jcTahK and here: http://assure.ly/gcXx03.

Hope that helps,

Niall