O
O
ol sm2017-08-15 00:24:27
symfony
ol sm, 2017-08-15 00:24:27

How to assign style class for each select in symfony formtype?

Goodnight.
Tell me how to connect style classes for each select in the form, the code is below:

public function buildForm(FormBuilderInterface $builder, array $options)
    {
    builder->add('birthday', BirthdayType::class, array(
                            'placeholder' => array(
                                'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
                            ),
                    
                            'label' => 'Дата рождения',
                            'attr' => array('class' => 'select_style')
                ))
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
ol sm, 2017-08-15
@ol_efk

Solved the problem, for those who come across,

{{ form_widget(form.birthday.day,{'attr': {'class':'name_class_style'}}) }}
{{ form_widget(form.birthday.month,{'attr': {'class':'name_class_style'}}) }}
{{ form_widget(form.birthday.year,{'attr': {'class':'name_class_style'}}) }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question