2👍
✅
Change your template select
options to:
<option value="{{ item.id }}"
{% ifequal teacher_id item.id %}selected{% endifequal %}
>{{ item.title}} {{ item.name }} {{ item.surname }}</option>
It will test if the the option id is equal to teacher_id
, and add the selected
tag if true.
the same for option 0:
<option value="0" {% ifequal teacher_id 0 %}selected{% endifequal %}>blank</option>
Source:stackexchange.com