Reputation: 245
I have a class called Offices which contains id and officeName among other attributes. I'm trying to fill a select control with all possible values for that class and then set the select control to the value for the current record (stored as customer.officeName)
{% for office in offices %}
<option value="{{ office.Id}}">{{ office.officeName}} </option>
{% if %}
(office.id== customer.officeName) ? ' selected ' : ''
{% endif %}
{% endfor %}
</select>
Any suggestions on how I can update the above syntax to work?
Upvotes: 1
Views: 558
Reputation: 245
Figured it out
this works
{% for office in offices %}
<option value="{{ office.Id}}"
{% if (office.Id== customer.managingOffice) %}
{{ 'selected'}}
{% endif %}
>{{ office.officeName}}</option>
Upvotes: 1