How to get text value of object in a drop down?

I have a dropdown control with the following data source that contains objects.
fd.field('DropDown0').widget.setDataSource(datasource);var datasource = [
{ value: 0, text: "A" },
{ value: 1, text: "B" },
{ value: 2, text: "C" },
{ value: 3, text: "D" },
{ value: 4, text: "E" }
fd.field('DropDown0').widget.setOptions({dataTextField : 'text', dataValueField: 'value'});

The syntax below doesn't work for text. I know how to get value but how do you get the text value?
fd.field('test').value = fd.field('DropDown0').text;

Thank you for your help!

Hello @COR6603,

Welcome to Plumsail Community!

You can get the text value of the selected item using this code:


That works! Thank you very much!

1 Like