Skip to content
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

[Form] Some form errors are no longer shown since 3.4.41 #37025

Closed
ostrolucky opened this issue May 31, 2020 · 5 comments
Closed

[Form] Some form errors are no longer shown since 3.4.41 #37025

ostrolucky opened this issue May 31, 2020 · 5 comments

Comments

@ostrolucky
Copy link
Contributor

Symfony version(s) affected: 3.4.41

Description
Since b819d94 some form field errors have been hidden.
How to reproduce
I am able to reproduce when using property_path option set to field to another object and form_rest. Attaching reproducer symfony-demo.zip

Go to http://127.0.0.1:8000/en/admin/post/1/edit and hit submit. Field "author name" should show error, but doesn't. Web profiler toolbar does show form error.

cc @xabbuh

@bendavies
Copy link
Contributor

It's not even as complex as property_path being on another object.
It can just be an field on the current object, but with a different name to the form field. i.e.

->add('amount_closing_balance', MoneyType::class, [
    'property_path' => 'closingBalance',
])

So far I've found the Violation Path is changing:
4.4.8: children[amount_closing_balance].children[amount]
4.4.9: children[closingBalance].children[amount]

And then maybe the ViolationMapper in the Form component can no longer map this path back to the correct field.

@xabbuh
Copy link
Member

xabbuh commented Jun 1, 2020

Thank you for the feedback. I am working on a patch.

@xabbuh
Copy link
Member

xabbuh commented Jun 3, 2020

Can you both confirm that #37085 would fix this issue?

@ostrolucky
Copy link
Contributor Author

It solves the issue for me

@xabbuh
Copy link
Member

xabbuh commented Jun 3, 2020

@ostrolucky Thank you for the confirmation. 👍

fabpot added a commit that referenced this issue Jun 4, 2020
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] properly cascade validation to child forms

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37025, Fix #37027
| License       | MIT
| Doc PR        |

TODO:

- [x] improve test coverage

Commits
-------

7df5298 properly cascade validation to child forms
@fabpot fabpot closed this as completed Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants