Making a field required does not set the right attributes. Looks like a core bug.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | conditional_fields-2983462-2-Fix-required-handling.patch | 1.35 KB | geek-merlin |
Making a field required does not set the right attributes. Looks like a core bug.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | conditional_fields-2983462-2-Fix-required-handling.patch | 1.35 KB | geek-merlin |
Comments
Comment #2
geek-merlinPatch flying in.
Comment #4
geek-merlinTested and used in production, so committing.
Comment #6
gintass commentedIf I understand correctly this development version already has a patch: 8.x-1.0-alpha4+7-dev (2018-Jul-10)
I tested with the reference field that becomes visible AND required based on another fields value. The field is a reference to a taxonomy vocabulary with view terms. The terms are being displayed as selectable radio buttons in the reference field.
The field becomes required, when condition is fulfilled, but the "required" indicator (red star) is being displayed next to each option instead of a label. Also when I try to save the node with one of the options selected I get the error:
"The website encountered an unexpected error. Please try again later."
In another test I set the field to "required" in the field configuration and made it invisible if control field is not checked. In this case it worked. I was able to create the node without selecting any values in the required field wasn't visible on the form. If this was your goal, so I guess you can consider that this patch works, but if you wanted to allow to set the "required" based on a condition, then this doesn't work, at least in case of a reference field with the list of options)
Comment #7
geek-merlinOK thanks for reporting this back! So i have reverted the patch (it's in beta5 but not in current dev) and setting NW.