-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Separate errors and display errors #9994
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
"errors_level": $builder->add('field', 'type', array(
// show errors on the field
'errors_level' => 'field',
// show errors on the form
'errors_level' => 'form',
)); "inline_errors": $builder->add('field', 'type', array(
// show errors on the field
'inline_errors' => true,
// show errors on the form
'inline_errors' => false,
)); |
field vs form is weird IMO, as everything is a Form in Symfony. It should be |
Which leads me to an alternative proposal: $builder->add('field', 'type', array(
// show errors on the field
'display_errors' => 'self',
// show errors on the parent form
'display_errors' => 'parent',
// show errors on the root form
'display_errors' => 'root',
)); |
|
maybe |
@stof what's the difference between your two proposals? |
sorry, edited it to actually give the 2 proposal I thought about |
what about Alternatively, |
So when you would want to show errors two levels higher in hierarchy, you would set I think the new option with |
+1 for second Bernhard proposition #9994 (comment) |
This would be a great change! I like error_scope too fwiw. |
👍 for the |
+1 for |
@webmozart Have there been any updates on this? |
👍 for |
@webmozart status bump? Is this issue still relevant or stale? |
If the value would be an array, you could choose multiple error locations: error_location => ['self','parent'] See #36729 |
Thank you for this issue. |
Let's close this old issue as nobody cared enough to implement this feature. |
I would like to separate errors and "display errors" in the form component. Therefore I would like to add two methods to
FormInterface
:The idea is that
getDisplayErrors()
should return the errors that should be displayed on a given form, whilegetErrors()
should only return the errors that were actually caused by the field. In this way, it will be possible to distinguish really erroneous fields from those that only display errors of other fields (#6001).To make that work, I would like to deprecate the "error_bubbling" option and introduce an equivalent option for the
addDisplayError()
method. The option should control the following:What should we call this option? "display_errors"?
Unfortuantely we cannot continue to use "error_bubbling", because then we need to break BC.
The text was updated successfully, but these errors were encountered: