Answer the question
In order to leave comments, you need to log in
How to set up form symfony?
<div class="form-group">
<label class="col-sm-3 control-label" for="form-control-1">Название</label>
<div class="col-sm-9">
{{ form_row(categories_create_form.title) }}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="form-control-2">Password input</label>
<div class="col-sm-9">
<input id="form-control-2" class="form-control" type="password" value="test.1234">
</div>
</div>
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, ['attr' => ['class' => 'form-control']])
->add('save', SubmitType::class, ['label' => 'Create', 'attr' => ['class' => 'btn btn-primary']]);
}
Answer the question
In order to leave comments, you need to log in
Instead {{ form_row(categories_create_form.title) }}
, use {{ form_widget(categories_create_form.title) }}
To display the field name separately -{{ form_label(categories_create_form.title) }}
->add('title', TextType::class, ['attr' => [
'class' => 'form-control'
'label' => 'blablabla'
]])
If my memory serves me, attribute
[
...
'label' => false
...
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question