Problems with using Checkboxes for Tags in a Tagset.

Created on 27 January 2021, over 3 years ago
Updated 3 December 2023, 7 months ago

1.0 Problem/Motivation
I have a field on the webform which has 'User Select' for setting two Tags, associated with a Contact, (contained in a Tagset) i.e. Multiple valued.

  • If the box is ticked the Tag is set.
  • If the box is unticked the Tag is unchanged, whether set originally or not.

I suspect from the code that the same may be true of Groups, but not yet tried.

See also #2 below. The behaviour seems to have changed.

2.0 Detailed steps to reproduce (embed screenshots)
See sample webform attached.
Running Webform_civicrm 8.x-5.0-beta4, Webform 6.0.0, CiviCRM 5.33.2.

3.0 Observations so far
This appears to be down to code not creating the $add and $remove arrays correctly in saveGroupsAndTags() in the file wf_crm_webform_preprocess.inc, or in the getExposedOptions() function which it calls. I do not understand this code well enough to debug it any further.

The screenshot shows the content of $contact when entering saveGroupsAndTags(), and $add and $remove at the end, with one box ticked and the other unticked.

I note that getExposedOptions() is looking for Live and Static options, and I also note that on the configuration screen neither the Live or Static setting causes any options to be displayed. Could this be related?

Finally, the fact that there is a line in $add of '12 => 0' means that after applying the $add = array_combine($add, $add); on line 932 it goes on to try to create a Tag with Id zero, and throws a PHP Error. I don't know if this will go away by fixing the above.

πŸ› Bug report
Status

Fixed

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024