Accessing selected items in multiselect list

Hello,

I have a multi-select list box (called: selectCompanies).

image

It pulls these values from my database, using this query:SELECT id, company_name, sector_id from company WHERE sector_id = {{Sector.selectedItem.id}}

I want to list the selected items from this list box into a text field, separated by a comma.
I'm struggling to even read the full array of selected items into my text box:

How can I get my selected items, into my text box as a string (and separated with a comma).

Hope to hear,
thanks
Neil

Hello, you can try this

selectCompanies.selectedLabels.join(", ")

Oscar,

That worked a treat, thank you. Much appreciated.

I was trying just selected labels before - to try and at least get the data in the textbox, but that didn't work, so I thought i was going down the wrong path. The 'join' additions makes it all good.

thanks again,
Neil

1 Like