I am trying to get default radio checked with symfony or twig but i am not able to do
for example i have a gender form field that contains male and female and i want to have one of them to be checked by default
i looked in symfony documentation but i din't find any solution
This is the formfield that i want to set a default
->add('gender', ChoiceType::class, [
'choices' => [
'Male' => 'male',
'Female' => 'female',
],
'expanded' => true
])
This is twig code
{% for gender in form.member.gender %}
{{
form_row(gender, {label_attr: {'class': 'radio-custom'}})
}}
{% endfor %}