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

  1. Create a field with type list (text) and field setting allowed number of values to unlimited
  2. Create condition where target is above created field and condition is required.
  3. 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

Comments

anand.toshniwal93 created an issue. See original summary.

anand.toshniwal93’s picture

Title: If target field multiple checkbox and condition is required then all checkboxes are being required. » If target field is multiple checkbox and condition is required then all checkboxes are being required.
anand.toshniwal93’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha9
kris77’s picture

Same issue...

mastap’s picture

Status: Active » Needs work

Same issue here. Unusable.

mastap’s picture

Version: 8.x-1.0-alpha9 » 4.0.0-alpha1

Same 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.

kris77’s picture

any news on this issue?

tim@lammar.be’s picture

StatusFileSize
new2.69 KB

I 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.

tim@lammar.be’s picture

StatusFileSize
new2.8 KB

update: only add required state to widget if it is a 'multiple' field (parent is int, the id of the term)

saurabh-2k17’s picture

Assigned: Unassigned » saurabh-2k17
saurabh-2k17’s picture

Status: Needs work » Needs review
StatusFileSize
new3.03 KB

The 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

saurabh-2k17’s picture

StatusFileSize
new4.64 KB

I 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.

rcodina’s picture

Patch on #12 works for me.

szhu’s picture

Status: Needs review » Reviewed & tested by the community

  • saurabh-2k17 authored 3256b32a on 4.x
    Issue #3165898 by saurabh-2k17: If target field is multiple checkbox...
saurabh-2k17’s picture

Thank you everyone for your support.

saurabh-2k17’s picture

Status: Reviewed & tested by the community » Fixed
paulabeatriz03’s picture

Patch not working on 4.0.0-alpha2

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.