I think its a simple question. Its about outputting errors.
This is my twig file:
<table>
<tr>
<td>{{ form_label(form.dueDate) }}</td>
<td>{{ form_widget(form.dueDate) }}</td>
<td>{{ form_errors(form.dueDate) }}</td>
</tr>
<tr>
<td>{{ form_label(form.task) }}</td>
<td>{{ form_widget(form.task) }}</td>
<td>{{ form_errors(form.task) }}</td>
</tr>
</table>
Now each error displays (td with form_errors()) as:
< ul>< li>This value should not be blank< /li>< /ul>
My question is: I want to output error as plain text (without ul and li).
I know there is an example like this:
{% for error in errors %}
{{ error.message }}
{% endfor %}
But this will output errors one after another. I want to display them where specific input is:
< td>{{ myErrorFor form.dueDate }}< /td>
Big thanks for any help
You can customize how form errors render by providing your own form theme with a
field_errorsblock.You can do this for just the current template:
Or by defining a global form theme in
config.yml:In this case you would want to move the
field_errorsblock above toapp/Resources/views/form_theme.html.twigand theform_themetag is no longer necessary.