[Fixed]-Html selector option selected based on django provided variable value

1👍

Some comments suggested my question is not clear which I agree it could be the case. Please forgive me, English is not my native language, but I’m trying 🙂

In the meanwhile a colleague of mine provided me with a solution I was looking for.

And here it is:

<select name="lvl4_{{ ticket.0 }}">
<option {% if ticket.1 == "Run Support" or ticket.1 == "User Support" %}selected {% endif %} disabled>incorrect ticket type</option>
<option {% if ticket.1 == "Change Request" %}selected {% endif %} value="Change Request">Change Request</option>
<option {% if ticket.1 == "Internal Ticket" %}selected {% endif %} value="Internal Ticket">Internal Ticket</option>
<option {% if ticket.1 == "Enhancement Request" %}selected {% endif %} value="Enhancement Request">Enhancement Request</option>
<option {% if ticket.1 == "Technical Request" %}selected {% endif %} value="Technical Request">Technical Request</option>
</select>

Leave a comment