-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Form errors rendered twice for one field. #29187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would be solved if you don't render Otherwise, why cant you disable the errors in the label by overriding its block:
no? |
The Bootstrap 4 theme renders errors inside |
If we can not render error on our own then this thing is against this document Customize Form Rendering And if I am just using Then out looks like this: |
the page you link has a note about reading more on the BS 4 theme, and that page tells you about the fact that errors are rendered inside the label: https://symfony.com/doc/current/form/bootstrap4.html#labels-and-errors @javiereguiluz would it make sense to add a dedicated note in the |
@stof I am perfectly fine what you said but the thing is that the page layout is broken as you can see in the image I attached. |
I am closing here as this is the expected behaviour (though currently being discussed in #28086). |
guess i'm late but @jawadmjn is right @xabbuh this does not work as expected. as it's written in the docs (https://symfony.com/doc/current/form/form_customization.html) the the provided code sample in the docs would be also wrong as it ouputs the errors twice: <div class="form-control">
<i class="fa fa-calendar"></i> {{ form_label(form.dueDate) }}
{{ form_widget(form.dueDate) }}
<small>{{ form_help(form.dueDate) }}</small>
<div class="form-error">
{{ form_errors(form.dueDate) }}
</div>
</div>``` |
It looks like symfony/symfony-docs#13685 will clarify that. |
Symfony version(s) affected: 4.1
Description
It occurs in this commit
By putting errors in the label now the following issue occurs. And we can not use Customize Form Rendering
For example when I am putting a field like this:
And Error occured then The error message is one time showing in label and 2nd time what i put form_errors.
Possible Solution
So we should take errors out from the label and have to put form_errors in form_row And we have to put form_errors in the end otherwise if the error occurs then error area will push the whole layout down.
The text was updated successfully, but these errors were encountered: