I have problem with checkboxes which I render by FormBuilder.
The problem is that <input/>
is generated inside <label></label>
. The result is the following:
I don't know what I should do to format this checkboxes to the state on the right side of the image. I check documentation and I have not found any methods which can give access to change the way how this fields are rendered.
Twig:
{{ form_widget(form.colors, { 'attr': {'class': 'MY-CLASS'} } ) }}
HTML Result:
<div id="template_colors" class="MY-CLASS">
<input type="checkbox" id="template_colors_0" name="template[colors][]" value="white">
<label for="template_colors_0">White</label>
<input type="checkbox" id="template_colors_1" name="template[colors][]" value="red">
<label for="template_colors_1">Red</label>
<input type="checkbox" id="template_colors_2" name="template[colors][]" value="black">
<label for="template_colors_2">Black</label>
</div>
Aucun commentaire:
Enregistrer un commentaire