Expand my Community achievements bar.

is it possible to get the key/value of the dropdown?

Avatar

Level 1

I have a dropdown, and the data are from the backend (please see the attached spreadsheet). Is it possible get the key/value of the dropdown when I choose one item from the dropdown? I know you can use xfa.event.newText to get the text, but I also need to get the key/value for the item.

Thanks,

-Tony

1 Reply

Avatar

Level 10

Hi,

Here is a sample. The drop down has the text values of the asset classes. In the Object / Binding tab the specified values are set for each of the asset classes.

If you have LC Designer ES2 you can copy the assets from the Excel spreadsheet directly into the dropdown. Otherwise you would have to add them one at a time in the Object / Field tab or script them.

Anyway, once a user selects a choice from the dropdown you can access the bound value using :

this.rawValue = assetClass.rawValue; 

And you can access the display text using:

var vChoice = assetClass.selectedIndex;

this.rawValue = assetClass.getDisplayItem(vChoice);

Hope that helps,

Niall