example_field:
    '#type': custom_composite
    '#title': 'Label'
    '#multiple__header': false
    '#multiple__item_label': 'Tankkaart'
    '#multiple__min_items': 1
    '#multiple__empty_items': 0
    '#multiple__sorting': false
    '#multiple__add': false
    '#multiple__remove': false
    '#multiple__add_more_input': false
    '#multiple__add_more_button_label': 'Voeg nog een itemtoe'
    '#wrapper_type': container
    '#element':
      products:
        '#type': checkboxes
        '#options':
          diesel+adblue: 'Diesel en AdBlue'
          benzine+95+e10: 'Benzine 95 E10'
          benzine+98+e5: 'Benzine 98 E5'
          lpg: LPG
          gasolie+diesel: 'Gasolie diesel (rode mazout)'
          kero+type+c: 'Kero Type C'
        '#title': Producten

submission in database is "Array" and also in the mail is "Array"

Issue fork webform-3216923

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

michiellucas created an issue. See original summary.

michiellucas’s picture

I created a patch for saving and loading these values

michiellucas’s picture

Issue summary: View changes
jrockowitz’s picture

Category: Bug report » Feature request
Priority: Critical » Normal
Status: Active » Needs review

I am very hesitant to start supporting this feature because of the risk of regressions. But, at the same time, I understand why having support for multi-select and checkboxes within a composite is important.

Instead of pipe-delimited values, my initial thought is that we need to serialize the values using JSON, YAML, or PHP. I am partial to using YAML, but I open to suggestions.

Also, this improvement is going to require a decent amount of test coverage.

Thank you for creating the first patch.

michiellucas’s picture

It works for my setup and is already in production, i think that with some easy changes you can support it.

Love the composite work, amazing webforms you can build without custom code.

marcusvsouza’s picture

StatusFileSize
new290.33 KB
new38.67 KB

The patch in comment #2 applies without problems and work good, it remains to assess the feasibility of the implementation.

  • a797043 committed on 3216923-composite-multiple
    Issue #3216923: Radios or Checkboxes inside Composite not saved
    
jrockowitz’s picture

Version: 6.0.3 » 8.x-5.x-dev
StatusFileSize
new11.07 KB

The attached patch uses serialization and tweaks \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::formatComposite to support multiple values.

This is a major improvement that is changing how some data is stored, My thoughts are we should implement it using the least amount of code with a lot of test coverage.

Also, I would like to implement this feature in 8.x-5.x and then merge into 6.x

  • 7939b74 committed on 3216923-composite-multiple
    Issue #3216923: Radios or Checkboxes inside Composite not saved
    

Status: Needs review » Needs work

The last submitted patch, 8: 3216923-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • aff6309 committed on 3216923-composite-multiple
    Issue #3216923: Radios or Checkboxes inside Composite not saved
    
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes
jrockowitz’s picture

StatusFileSize
new12.06 KB
paulocs’s picture

I'll write some tests for it.

jrockowitz’s picture

@paulocs Please hold off writing the automated tests. We need to create more test webform examples.

For example, we need to manually test adding checkboxes to a composite in code,

paulocs’s picture

Okay. I already wrote some test to the webform created in #13. Nothing big

For example, we need to manually test adding checkboxes to a composite in code

Do you mean for example via hook?

jrockowitz’s picture

Maybe add checkboxes to the webform_example_composite.module

paulocs’s picture

StatusFileSize
new4.33 KB
new15.52 KB

Please review...
I added a checkboxes field via hook to the composite element.

jrockowitz’s picture

Assigned: Unassigned » jrockowitz

Please let me moving this ticket forward and I will ping you as it needs review.

  • 206fae5 committed on 3216923-composite-multiple
    Issue #3216923: Radios or Checkboxes inside Composite not saved
    
jrockowitz’s picture

StatusFileSize
new17.34 KB

So I added checkboxes to example composite and fixed a few related bugs.

I think for an MVP we should just support checkboxes and multi-select. Support for other multiple value elements (manually table selects) can be added later (or never)

Status: Needs review » Needs work

The last submitted patch, 21: 3216923-19.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • 440fa61 committed on 3216923-composite-multiple
    Issue #3216923: Radios or Checkboxes inside Composite not saved
    
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new20.3 KB
jrockowitz’s picture

Assigned: jrockowitz » Unassigned
StatusFileSize
new20.31 KB

Fixing minor typo. This patch needs to be reviewed by someone else.

marcusvsouza’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new96.84 KB
new78.71 KB

The patch in the comment #25 save the checkboxes correctly, not affecting others functionalities.

jrockowitz’s picture

Status: Reviewed & tested by the community » Needs review

@marcusvsouza Thank you for reviewing the patch. This is a major change and probably requires more review and consideration.

michiellucas’s picture

Thanks for the improvement but i am missing

public static function getOptionText($value, array $options, $options_description = FALSE) {

So the values are represented in the mails or did you fix this a different way?

jrockowitz’s picture

I tried to fix the display of the values at a higher level. Can you create an example webform that can be used to reproduce what you are seeing via email.

jrockowitz’s picture

Priority: Normal » Major

Changing the priority to Major since the feature request is going to require a lot of review and testing.

jonmcl’s picture

This is working very well for us. Composite element with a custom checkboxes element.

I created a second issue to handle re-rolls for 6.x: #3240605: Radios or Checkboxes inside Composite not saved (6.x-dev clone)

jedihe’s picture

I suggest you consider using JSON format for serialization, as DB engines are capable of handling JSON; doing this should get submissions better prepared to perform query/manipulation directly with DB primitives/plug-ins, which should be way more performant than grep'ping + PHP-land unserialization. For reference, see:

jrockowitz’s picture

@jedihe That was exactly the type of suggestion I was looking for via #4. Thanks.

JSON it is.

jrockowitz’s picture

StatusFileSize
new14.5 KB

Status: Needs review » Needs work

The last submitted patch, 34: 3216923-34.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new14.52 KB
maijs’s picture

Thanks, @michiellucas and @jrockowitz for great work!

Couple of things I'd like to suggest:

1. Hardcoding webform element types which are supported in composite element in Plugin\WebformElement\WebformCompositeBase::isSupportedElementType() and in Element\WebformElementComposite::validateWebformElementComposite() methods make it really hard to make it work with custom webform element types which directly extend the allowed hardcoded type classes, e.g., Checkboxes or Radios.

In a project I'm working on I have several custom webform element types which extend said classes (e.g., class DecoupledCheckboxes extend Checkboxes). They are not going to work with current implementation, even if they are technically completely compatible.

2. The logic behind checking if a particular element type is supported by a composite element type is scattered across many related classes like Plugin\WebformElement\WebformCompositeBase and Element\WebformElementComposite. It becomes very hard to override methods like Plugin\WebformElement\WebformCompositeBase::isSupportedElementType() because it requires at least two class overrides which is cumbersome and hardly maintainable.

Given that Plugin\WebformElement\WebformCompositeBase::isSupportedElementType() and Element\WebformElementComposite::validateWebformElementComposite() methods are designed to work within the webform_custom_composite webform element plugin (or the extended classes of this class), I think it's best if is-this-type-allowed checks are performed by the composite webform element plugin itself. This will allow for easier customizations in the extended classes of the custom webform types, and will also keep the logic contained in one place.

3. Currently Plugin\WebformElement\WebformCompositeBase::isSupportedElementType() method returns FALSE for element plugins which are instance of WebformElementEntityReferenceInterface.

After doing some testing, I can report that term reference option webform element works fine within the composite element and multiple reference term IDs are nicely saved as multiple values in the database.

It's fine to disable term reference elements by default, if maintainers have concerns that this may cause regressions. But, going back to first two points I raised, currently it's a huge headache to override the logic in isSupportedElementType() method in cases where there's no such concern.

Also, I really hope that patches in this issue will end up in 6.x branch as well.

jrockowitz’s picture

Yes, I am very concerned about unexpected issues with composite sub-elements which is why WebformCompositeBase::isSupportedElementType acts as a whitelist. In a separate ticket, we could rework the code to allow a webform element to determine if it can or can't be used as a composite sub-element.

maijs’s picture

StatusFileSize
new14.81 KB

Re-rolling 3216923-36.patch for 6.x branch.

Status: Needs review » Needs work

The last submitted patch, 39: multi-value-composite-6.x-3216923-39.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jrockowitz’s picture

Version: 8.x-5.x-dev » 6.x-dev
Status: Needs work » Needs review
StatusFileSize
new14.47 KB

I will probably not commit this feature until 6.2.x

jonmcl’s picture

Status: Needs review » Needs work

Patch at #41 does not currently work with 6.1.1, 6.1.2 or current 6.x-dev. It does work with 6.1.0

jrockowitz’s picture

Version: 6.x-dev » 6.2.x-dev
jrockowitz’s picture

jrockowitz’s picture

Priority: Major » Normal
Status: Needs work » Needs review

I updated the patch to work with Webform 6.2.x. I am very hesitant to merge this because I think it may create more issues that it is worth.

jonmcl’s picture

StatusFileSize
new15.13 KB

Please don't drop this :)

We are successfully using it in production (with 6.1.2). Our composite elements have textfield, textarea, and checkboxes. What sort of issues to you foresee happening by merging this into a release? Anything specific that I could test for?

Very minor re-rolll for 6.1.2 (currently recommended version).

rossb89’s picture

StatusFileSize
new14.64 KB

Did a minor re-roll for 6.1.3 in case anyone needs it for the latest 6.1.x version :)

KristineC’s picture

Tested @JonMcL's patch file on Drupal 9 and 6.1.2. Seems to be working fine with fields saving.

elneto’s picture

Ok, I am shooting in the dark here. I added #36 patch trying to fix the error below. It happens only when I click on one of the composite checkboxes and submit the webform. Just wanted to see if anyone had run into this. Trying to figure what is causing it.

I am using Drupal 9.3.12 on php 8.1.5 and Maria db 10.6.7-MariaDB-2ubuntu1.

Thanks!

TypeError: Illegal offset type in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 136 of /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Render/Element/Checkboxes.php)
#0 [internal function]: Drupal\Core\Render\Element\Checkboxes::valueCallback()
#1 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1258): call_user_func_array()
#2 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1000): Drupal\Core\Form\FormBuilder->handleInputElement()
#3 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#4 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#5 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#6 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#7 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#8 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#9 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#10 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(1070): Drupal\Core\Form\FormBuilder->doBuildForm()
#11 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(574): Drupal\Core\Form\FormBuilder->doBuildForm()
#12 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm()
#13 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm()
#14 /var/www/sdgs.localhost/web/modules/contrib/webform/src/Entity/Webform.php(1243): Drupal\Core\Entity\EntityFormBuilder->getForm()
#15 /var/www/sdgs.localhost/web/modules/contrib/webform/src/Controller/WebformEntityController.php(76): Drupal\webform\Entity\Webform->getSubmissionForm()
#16 [internal function]: Drupal\webform\Controller\WebformEntityController->addForm()
#17 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#18 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#20 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#21 /var/www/sdgs.localhost/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /var/www/sdgs.localhost/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /var/www/sdgs.localhost/web/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(46): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\redirect_after_login\RedirectMiddleware->handle()
#25 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#26 /var/www/sdgs.localhost/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#27 /var/www/sdgs.localhost/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /var/www/sdgs.localhost/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#30 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#31 /var/www/sdgs.localhost/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#32 /var/www/sdgs.localhost/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#33 /var/www/sdgs.localhost/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#34 {main}
.
plessas’s picture

I am also facing the TypeError: Illegal offset type in Drupal\Core\Render\Element\Checkboxes::valueCallback() error that @elneto reports, with version 6.1.3 of the module and patch #48. The details of the environment are: Drupal 9.3.12 and php 8.1.5. This was previously working (tested with a previous version of php - not sure which 8.1.x- and with Drupal 9.3.7 - I haven't used it with newer Drupal core versions until today), however I an not sure what broke it (Drupal core update or possibly the PHP update).

danthorne’s picture

#48 working for me, apart from when I add the field in a view (webform_views installed). Array is outputted rather then the actual submitted data.

plessas’s picture

@danthorne which Drupal core version are you using?

I am currently using Drupal 9.4.4, Webform 6.1.3 and the error still appears with patch #48.

For anyone interested for a quick workaround (unfortunately I didn't have the time to search for an appropriate solution), the problem occurs since in line 136 of core/lib/Drupal/Core/Render/Element/Checkboxes.php:

if (!empty($element[$key]['#disabled'])) {

$key is actually an array.

Replacing (using a local patch) that line with the one below seems to solve the problem (at least for my use case):

if (!is_array($key) && !empty($element[$key]['#disabled'])) {
danthorne’s picture

Currently using Drupal 9.4.3 and Webform 6.1.3

bbombachini’s picture

Status: Needs review » Needs work

I'm on D9.5 and php 8.1

Tried the patch #48 with webforms 6.1.4 and tried the patch from the MR (https://git.drupalcode.org/project/webform/-/merge_requests/123.patch) with version 6.2.0-beta5 (latest release) and the dev version, but all the 3 gave me the same error as #50 on form submission:

TypeError: Illegal offset type in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 136 of core/lib/Drupal/Core/Render/Element/Checkboxes.php).

So I'm moving this to needs work.

phonkala’s picture

For me the parth #48 works fine right after applying it, using Drupal 10.0.8, Webforms 6.2.0-beta5 and PHP 8.1. This feature was very much needed and as it's just saving the data as JSON string, I don't think adding this to the actual module would be much of an issue. However if that is not desired, maybe this could be moved to a separate module while it's not considered stable?

And for @bbombachini, I had no issue using checkboxes and submitting form, no errors there.

bbombachini’s picture

Interesting @phonkala, I'm still testing this on D9.5.3, webform 6.2.0-beta5, PHP 8.1, and the patch from #48. And I still have the same error:

TypeError: Illegal offset type in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 136 of core/lib/Drupal/Core/Render/Element/Checkboxes.php).

So I created a simple webform for testing, can you try using this form and tell me what it gives you for $element[$key] on line 36 of core/lib/Drupal/Core/Render/Element/Checkboxes.php?

I have the same issue as outlined on comment #53 where $key is an array.

uuid: 04b7199e-cd72-46ba-954d-d4e196f58f43
langcode: en
status: open
dependencies: {  }
weight: 0
open: null
close: null
uid: 85
template: false
archive: false
id: test
title: Test
description: ''
category: ''
elements: |-
  custom_composite_test:
    '#type': webform_custom_composite
    '#title': 'Custom composite test'
    '#element':
      select_options:
        '#type': webform_checkboxes_other
        '#options':
          test1: 'Test 1'
          test2: 'Test 2'
          test3: 'Test 3'
          test4: 'Test 4'
        '#title': 'Select options'
css: ''
javascript: ''
settings:
  ajax: false
  ajax_scroll_top: form
  ajax_progress_type: ''
  ajax_effect: ''
  ajax_speed: null
  page: true
  page_submit_path: ''
  page_confirm_path: ''
  page_theme_name: ''
  form_title: both
  form_submit_once: false
  form_open_message: ''
  form_close_message: ''
  form_exception_message: ''
  form_previous_submissions: true
  form_confidential: false
  form_confidential_message: ''
  form_disable_remote_addr: false
  form_convert_anonymous: false
  form_prepopulate: false
  form_prepopulate_source_entity: false
  form_prepopulate_source_entity_required: false
  form_prepopulate_source_entity_type: ''
  form_unsaved: false
  form_disable_back: false
  form_submit_back: false
  form_disable_autocomplete: false
  form_novalidate: false
  form_disable_inline_errors: false
  form_required: false
  form_autofocus: false
  form_details_toggle: false
  form_reset: false
  form_access_denied: default
  form_access_denied_title: ''
  form_access_denied_message: ''
  form_access_denied_attributes: {  }
  form_file_limit: ''
  form_attributes: {  }
  form_method: ''
  form_action: ''
  share: false
  share_node: false
  share_theme_name: ''
  share_title: true
  share_page_body_attributes: {  }
  submission_label: ''
  submission_exception_message: ''
  submission_locked_message: ''
  submission_log: false
  submission_excluded_elements: {  }
  submission_exclude_empty: false
  submission_exclude_empty_checkbox: false
  submission_views: {  }
  submission_views_replace: {  }
  submission_user_columns: {  }
  submission_user_duplicate: false
  submission_access_denied: default
  submission_access_denied_title: ''
  submission_access_denied_message: ''
  submission_access_denied_attributes: {  }
  previous_submission_message: ''
  previous_submissions_message: ''
  autofill: false
  autofill_message: ''
  autofill_excluded_elements: {  }
  wizard_progress_bar: true
  wizard_progress_pages: false
  wizard_progress_percentage: false
  wizard_progress_link: false
  wizard_progress_states: false
  wizard_start_label: ''
  wizard_preview_link: false
  wizard_confirmation: true
  wizard_confirmation_label: ''
  wizard_auto_forward: true
  wizard_auto_forward_hide_next_button: false
  wizard_keyboard: true
  wizard_track: ''
  wizard_prev_button_label: ''
  wizard_next_button_label: ''
  wizard_toggle: false
  wizard_toggle_show_label: ''
  wizard_toggle_hide_label: ''
  wizard_page_type: container
  wizard_page_title_tag: h2
  preview: 0
  preview_label: ''
  preview_title: ''
  preview_message: ''
  preview_attributes: {  }
  preview_excluded_elements: {  }
  preview_exclude_empty: true
  preview_exclude_empty_checkbox: false
  draft: none
  draft_multiple: false
  draft_auto_save: false
  draft_saved_message: ''
  draft_loaded_message: ''
  draft_pending_single_message: ''
  draft_pending_multiple_message: ''
  confirmation_type: page
  confirmation_url: ''
  confirmation_title: ''
  confirmation_message: ''
  confirmation_attributes: {  }
  confirmation_back: true
  confirmation_back_label: ''
  confirmation_back_attributes: {  }
  confirmation_exclude_query: false
  confirmation_exclude_token: false
  confirmation_update: false
  limit_total: null
  limit_total_interval: null
  limit_total_message: ''
  limit_total_unique: false
  limit_user: null
  limit_user_interval: null
  limit_user_message: ''
  limit_user_unique: false
  entity_limit_total: null
  entity_limit_total_interval: null
  entity_limit_user: null
  entity_limit_user_interval: null
  purge: none
  purge_days: null
  results_disabled: false
  results_disabled_ignore: false
  results_customize: false
  token_view: false
  token_update: false
  token_delete: false
  serial_disabled: false
access:
  create:
    roles:
      - anonymous
      - authenticated
    users: {  }
    permissions: {  }
  view_any:
    roles: {  }
    users: {  }
    permissions: {  }
  update_any:
    roles: {  }
    users: {  }
    permissions: {  }
  delete_any:
    roles: {  }
    users: {  }
    permissions: {  }
  purge_any:
    roles: {  }
    users: {  }
    permissions: {  }
  view_own:
    roles: {  }
    users: {  }
    permissions: {  }
  update_own:
    roles: {  }
    users: {  }
    permissions: {  }
  delete_own:
    roles: {  }
    users: {  }
    permissions: {  }
  administer:
    roles: {  }
    users: {  }
    permissions: {  }
  test:
    roles: {  }
    users: {  }
    permissions: {  }
  configuration:
    roles: {  }
    users: {  }
    permissions: {  }
handlers: {  }
variants: {  }

elber made their first commit to this issue’s fork.

elber’s picture

Hi I just rebased.

phonkala’s picture

@bbombachini I was getting no output of that yaml (well, there was submit button) so checked into it a bit and seems the element types are named differently than mine. Modified the source "elements" section a bit, with this I got composite with checkboxes:

elements:
  custom_composite_test:
    '#type': custom_composite
    '#title': 'Custom composite test'
    '#element':
      select_options:
        '#type': checkboxes
        '#options':
          test1: 'Test 1'
          test2: 'Test 2'
          test3: 'Test 3'
          test4: 'Test 4'
        '#title': 'Select options'

And submitting gives no error.

Basically I just checked the element types from my other forms and replaced the ones you had with them. And also removed the "|-" part from the "elements" row.

phonkala’s picture

@bbombachini Ah now I see it, using "webform_checkboxes_other" as the element type sure does give the array key error! Weirdly, basic checkboxes work nicely and for example even "webform_select_other" works just fine.

EDIT: Tested submitting the form with "radios or other", "checkboxes or other" and "select with other" input types and only the "checkboxes with other" has the issue. Even "Select with other" with multiple enabled works great and does save submissions correctly.

jrglasgow made their first commit to this issue’s fork.

jrglasgow’s picture

StatusFileSize
new14.64 KB

The patch in #48 was no longer applying to 6.2.x (Drupal 10 compatible) so I fixed the merge conflict in the fork

alorenc made their first commit to this issue’s fork.

alorenc’s picture

Fixed "webform_checkboxes_other" issue and the failing tests.

alorenc’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 63: 3216923--6.2.x--62.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

alorenc’s picture

Status: Needs work » Needs review
StatusFileSize
new15.68 KB

Rolled patch with the latest updates from merge request

liam morland’s picture

Version: 6.2.x-dev » 6.3.x-dev
Status: Needs review » Needs work

Please rebase the merge request and get tests to pass. Which merge request is preferred?

I note that in addition to the two merge requests, there is also branch 3216923-composite-multiple.

apparatchik’s picture

How would one go about rebasing this for 6.3? besides the rebase, what else is needed to get this ready for beta?

liam morland’s picture

You could either cherry-pick all the needed commits or use git rebase --onto. Then force-push the branch and update the merge request to target 6.3.x.

jrockowitz’s picture

I don't want to implement this feature because it would require too much work to support it.

For example, the webform views module would most likely need to be updated and tokens will probably need to fixed.