Here is my code:
<div id='{{ admin }}' class='radio'>
{% for option in options %}
<label class='radio-inline'>
{% if user is defined and
usuario.admin is sameas(option['value']) %}
{{ radio_field('admin', 'id': null, 'value': option['value'], 'checked': true)}}
{% else %}
{{ radio_field('admin', 'id': null, 'value': option['value'])}}
{% endif %}
{{ option['text'] }}
</label>
{% endfor %}
</div>
Now, the problem is that, when the else
occurs, the checked dissapears from the radio that has it (deletes it). And if I try setting his checked
to false
, it just selects the last created radio button. Why?