Yellow Flag

This website version is not maintained anymore

Up to date documentation is available in Symfony 3.x website (see the dropdown menu above).

Hide form labels

By default, {{ form() }} and {{ form_row() }} are kind of aliases for {{ form_label() }}, {{ form_widget() }} and {{ form_errors() }}. If you want to avoid displaying useless labels for your collection elements, you should not use {{ form_row() }}, but manually render {{ form_widget() }} and {{ form_errors() }} instead.


This demostration is made of the following files (click to see on GitHub in a new tab):
    -     Controller/TroubleshootController.php
    -     Entity/Task.php
    -     Entity/Tasks.php
    -     Form/TaskType.php
    -     Form/TasksType.php
    -     Resources/views/Troubleshoot/hideFormLabels.html.twig

By default,{{ form_row() }}

Tasks
0
Task
Due date
1
Task
Due date

Should Eat before March 22, 2016 00:00

Should Sleep before March 23, 2016 00:00


By using{{ form_widget() }} without form theme

Task
Due date
Task
Due date

Should Eat before March 22, 2016 00:00

Should Sleep before March 23, 2016 00:00


By using a form theme [Recommanded]

Tasks
Task
Due date
Task
Due date

Should Eat before March 22, 2016 00:00

Should Sleep before March 23, 2016 00:00