Is it possible to format a new option created in a Select?
Hello all,
In my form, I have a select field that will display a list of buildings where the option is formatted in a certain way:
<strong>Building name</strong> - number, street | postal_code City (country)
I use a method to get the buildings and populate my options :
I use createOptionForm() to give users the option of adding a new building to the Select and, in accordance with the documentation, I use createOptionUsing to create my building in the DB :
Everything works except that my select only displays the building ID in my select. Is it possible to format it too, like the others? If so, how?
Thanks in advance for your help πSolution:Jump to solution
Hello all,
I finally figured out how to do it after a lot of research π
So, for my case I can use the getOptionLabelUsing method
...
1 Reply
Solution
Hello all,
I finally figured out how to do it after a lot of research π
So, for my case I can use the getOptionLabelUsing method
$value
is the value of the selected option (= the ID model)
And there is it π₯³