Conditionally required radios not validated server side

Created on 10 March 2025, about 1 month ago

I see it sort of appearing on several tickets but always more specific, or other context, so submitting new ticket.
Sorry in advance if I missed a relevant ticket.

For now a simple patch, because I feel this needs to worked out more for other cases.

What I saw is that when working with entity reference, the server side validation doesn't work.
My specific case: an entity reference field with radios as widget not getting errors on form submit.

What I noticed in code is that the key to determine that a required field is not filled in is to check if the value is empty.
For entity reference however, that value is a array with null for target_id. That doesn't however count as empty.

As said before, other cases might be there as well, so I'm using switch, even though I only tackle my case and default for now.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium Tim Lammar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024