Y
Y
Yuri Matveenko2018-04-17 12:40:40
symfony
Yuri Matveenko, 2018-04-17 12:40:40

How to wrap radio input in separate div?

There are a lot of radio inputs in the form, you need to put each one in a div, how can this be done?

//form
->add('sex', ChoiceType::class, array(
                "label" => 'Роль:',
                'choices' => array(
                    'Мужской' => 1,
                    'Женский' => 2
                ),
                'expanded' => true,
                'multiple' => false,
                'attr' => array(
                    'has_branching' => 1,
                    "branching_logic" => 0,
                    "section_header" => 'test'
                )
            ))

I take it out like this
{{ form_widget(form.budget) }}
I get abracadabra
<div id="create_task_sex" has_branching="1" branching_logic="0" section_header="test"><input type="radio" id="create_task_sex_0" name="create_task[sex]" required="required" value="1" /><label for="create_task_sex_0" class="required">Мужской</label><input type="radio" id="create_task_sex_1" name="create_task[sex]" required="required" value="2" /><label for="create_task_sex_1" class="required">Женский</label></div>

I would like to put each label + input in a div

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question