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 error() does not display field error #16165
Comments
What's a "mapped field"? Why do you expect errors set for |
I don't, thats why I added an explicit standalone error() call below :) As for the reason why, my hunch seems to be correct |
Ah so the error for the non-entity field |
Those are both entity fields, but only of of them is displayed in the form using control(). |
I debugged it further and it seems the error() actually returns
with CORE/src/View/Helper/FormHelper.php (line 772) So it is actually there, but with Once another control() related error shows up, the CSS rule makes it appear:
So I guess this boils down to error() also counting in the result of the form itself to be displayed as erroring to make validation errors visible. |
I took a look at the sandbox page, and the form error is in the page. It looks like your CSS is hiding the error messages though. The form control for flags doesn't have the error so it isn't marked as invalid. All of this behavior is working as intended so I don't know what needs to be fixed in Cake. |
Error standalone should not be hidden, same as other fields. But I dont have a good solution either. |
Description
Content of the $bitmaskedRecord->getErrors() error is
The live demo and code can be seen here:
https://sandbox.dereuromark.de/sandbox/tools-examples/bitmasks?required=1
Locally checked out it can also be reproduced directly via sandbox.local URL
So it is definitely there, and it used to work in 2.x/3.x days afaik.
CakePHP Version
4.x
What is super weird
Once I add
in the controller to kind of force the the flags field directly to be red, it displays the error twice (then suddenly the call works).
Makes me think the FormHelper has an issue accessing errors until an actual field in use did it.
The fix that kinda works is here: dereuromark/cakephp-sandbox#45
But for me this is more a workaround.
The text was updated successfully, but these errors were encountered: