Multiple-Choice Checkboxes are not filled

Created on 16 December 2024, 2 days ago

1.0 Problem

Multiple-Choice Checkboxes are not filled from the according CiviCRM Entity on Webform load.

2.0 Detailed steps to reproduce

I have a Custom Data Group used for the relation between two Contacts. One Custom Data Field is a multiple Choice, for languages (Data Type: Alphanumeric, Field Input Type: Checkboxes)
The Options look like:
Labels: Englisch, Deutsch,...
Values: Englisch, Deutsch,...

I add this to a Drupal civicrm webform through the common method of clicking the according check box in the CiviCRM tab.

Config for this element looks like this:

  civicrm_3_contact_2_relationship_custom_334:
    '#type': civicrm_options
    '#title': 'vereinbarte Sprachen'
    '#prepopulate': true
    '#options':
      Englisch: Englisch
      Spanisch: Spanisch
      Französisch: Französisch
      Italienisch: Italienisch
      Polnisch: Polnisch
      Portugiesisch: Portugiesisch
      Rumänisch: Rumänisch
      Vietnamesisch: Vietnamesisch
      Türkisch: Türkisch
      Äthiopisch: Äthiopisch
      Russisch: Russisch
      Ukrainisch: Ukrainisch
      Urdu: Urdu
      Arabisch: Arabisch
      Farsi: Farsi
      Kurdisch: Kurdisch
    '#states_clear': false
    '#default_value':
      - '[current-page:url:args:value:civicrm_3_contact_2_relationship_custom_334]'
    '#attributes':
      data-relationship-type: '23'
    '#extra':
      aslist: 0
      multiple: 1
    '#data_type': String
    '#has_help': true
    '#form_key': civicrm_3_contact_2_relationship_custom_334
    '#parent': civicrm_3_contact_2_relationship_fieldset
    '#exposed_empty_option': ''
    '#default_option': ''
    '#civicrm_live_options': '1'

Now I can set using multiple choice the language. So it is the right field and entity.

However on entering the webform the checkboxes are not set, or filled from the entity. Any other field like Custom Data Fields text or date are filled correctly.

I can preset exactly one language by adding: "?civicrm_3_contact_2_relationship_custom_334=Englisch" to the URL

3.0 Proposed resolution

I tried debugging the problem, and found that after WebformCivicrmPreProcess::fillForm is called, the default_value contains the correct values, which should be set.
So it has to be somewhere behind that.

I'm stug with debugging the js and not that confident by now, how loading default_value to the html element works...

🐛 Bug report
Status

Active

Version

6.2

Component

Webform/Drupal

Created by

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024