How to get multiple values from tail.select?

I'am working on kind of deprecated project which is using tail select. I have to use option 'multiple'. Everything works smooth, I am able to select multiple options BUT! the value do not change at all. I always see the value of first selected item.

My input: enter image description here

My options:

options.descriptions = true;
options.hideSelected = true;
options.hideDisabled = true;
options.multiLimit = 10;
options.multiShowCount = false;
options.multiContainer = true;

I found there is a div, which accumulate the selected items and keeps it's values. But I'd need it to create array named inputs or something...

enter image description here

Is here some hero to help? (I'd like to find out tail.select solution. I'm capable to catch form submit and map divs into array of inputs. But I don't wanna do that!.)


If you're trying to get these values with javascript, then you'll be experiencing the same issue that happens with normal select fields that have the multiple attribute. If that's the case, you could probably do...

const mySelectField = document.querySelector('select[name="departments"]');
const getVal = () => {
    const options = mySelectField.querySelectorAll('option:checked');
    return Array.from(options, e => e.value);
};

But for sending your values in the request payload, you'll need to ensure you have the array syntax addded to your field name...

<select name="departments[]" multiple>
    ...
</select>