Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How I should use radio_field?

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'] }}
    {% endfor %}

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?


Ok, it was cause of sameas. I had to use == (my my).