I have this FormulateInput select component:
<FormulateInput
name="broj_zns-a"
@change="setZns"
:value="brojZnsa"
type="select"
label="Broj ZNS-a*"
validation="required"
:validation-messages="{required: 'Ovo polje je obavezno'}"
:options="this.brojeviZnsa"
:placeholder="this.brojeviZnsa.length > 0 ? 'Odaberite' : 'Nema podataka'"
/>
Options are fetched from API and are set like this:
let brojeviZnsa = res.data.map(zns => ({
'value': zns["zns_unos_podataka_broj_znsa"],
'label': zns["zns_unos_podataka_broj_znsa"],
'id': zns["id"],
}));
this.brojeviZnsa = brojeviZnsa;
My problem is that I cant find a way to fetch option "id" in change event handler:
setZns(e) {
this.getZns(e.target.value);
},
e.target.value returns the value of the current option, but I need the "id" in the getZns function.
I tried using e.target.id but it is undefined.
Thanks for the help!