In my revel project, i have a select option that need to get selected after clicking submit button.
If i do it like this it works because .OptionType is a string so i need to compare it with string
<select class="chosen form-control" id="selectType">
<option disabled value='' style="display:none"> --------- </option>
<option {{ if eq .OptionType "1" }}selected{{end}} value="1">Option A</option>
<option {{ if eq .OptionType "2" }}selected{{end}} value="2">Option B</option>
<option {{ if eq .OptionType "3" }}selected{{end}} value="3">Option C</option>
</select>
But if i try to compare variable like .ID it throws an error
<select class="chosen form-control" id="selectValue">
<option {{ if eq .SelectedValue "all" }} selected {{end}} value='all'>
All Value
</option>
{{range .Circles}}
<option {{ if eq .SelectedValue .ID }} selected {{end}} value='{{.ID}}'>
{{.Name}}
</option>
{{end}}
</select>
Is there any way that i could convert .ID in the same line with if statement ?
Error Message:
executing "BackendReport/Finance.html" at <.SelectedValue>: can't evaluate field SelectedValue in type models.Value
template.go.htmlThis works in me. Hope its help you.