Problem/Motivation
When the target field is multiple checkboxes and condition is required then all the checkboxes are being required while expected output should be if any of the checkbox is selected then it should not throw an error while saving form saying that rest of the checkboxes are also required.
Steps to reproduce
- Create a field with type list (text) and field setting allowed number of values to unlimited
- Create condition where target is above created field and condition is required.
- When condition is met all the checkboxes are being required, so if we select one checkbox and try to submit form still we get an error remaining checkboxes are required
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3165898-12.patch | 4.64 KB | saurabh-2k17 |
Comments
Comment #2
anand.toshniwal93 commentedComment #3
anand.toshniwal93 commentedComment #4
kris77 commentedSame issue...
Comment #5
mastap commentedSame issue here. Unusable.
Comment #6
mastap commentedSame issue with latests: Bug Applies to 4.0.0-alpha1 released 20 May 2021 as well.
By the way, even if ALL checkboxes are checked, the field never validate.
Comment #7
kris77 commentedany news on this issue?
Comment #8
tim@lammar.be commentedI got it working using the attached patch.
JS: I see if there is a
<legend>field in the target, meaning it's a list of checkboxes, and then apply the required class there. (Also added support for vertical tabs)Module file: in the module file I noticed that the condition gets added to the first option of the list, rather then the whole widget. Put in a little fix for that and the serverside validation works correct.
Comment #9
tim@lammar.be commentedupdate: only add required state to widget if it is a 'multiple' field (parent is int, the id of the term)
Comment #10
saurabh-2k17 commentedComment #11
saurabh-2k17 commentedThe above patch was not getting applied as it was not created correctly. Also, there are some changes in the latest 4.0.0-alpha2 version of the module.
I have attached a working patch.
Thanks
Comment #12
saurabh-2k17 commentedI found that the above patch does not add the * sign on the top of the field to display as it a required field. This patch will fix that issue as well.
Comment #13
rcodinaPatch on #12 works for me.
Comment #14
szhu commentedComment #16
saurabh-2k17 commentedThank you everyone for your support.
Comment #17
saurabh-2k17 commentedComment #18
paulabeatriz03 commentedPatch not working on 4.0.0-alpha2