🇬🇧United Kingdom @alangallery

Account created on 17 January 2014, almost 11 years ago
#

Recent comments

🇬🇧United Kingdom alangallery

Further information - if rendering token as raw value [webform_submission:values:select_with_other_question:raw]

Get two errors showing on form:
User error: "select" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of core\lib\Drupal\Core\Render\Element.php).

User error: "other" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of core\lib\Drupal\Core\Render\Element.php).

Both regarding the token [webform_submission:values:select_with_other_question:raw]

_webform_token_get_submission_value('select_with_other_question:raw', Array, Object, Object, Object) (Line: 743)
webform_tokens('webform_submission', Array, Array, Array, Object)
🇬🇧United Kingdom alangallery

Thanks cilefen. I just used diff.

The patch failure message is error: Plugin/WebformElementBase.php: No such file or directory

Comparing a patch generated with Git its very similar to this one but with a/ b/ prefixes indicating the modified files. eg.

--- a/src/Plugin/WebformElementBase.php	2023-03-27 17:30:04.067928500 +0100
+++ b/src/Plugin/WebformElementBase.php	2023-03-27 17:38:59.712840100 +0100

I could amend the patch accordingly and upload again?

🇬🇧United Kingdom alangallery

In case its of use to others, for now I've added a pipe option to the functions formatHtmlItems and formatTextItems in WebformElementBase with this patch.

🇬🇧United Kingdom alangallery

Thanks cilefen

Creating a simple multi-paged test form with select other element didn't give errors, but adding a conditional visibility to the select other element did. So it seems to be related to have conditions in the form.

The form I'm creating has lots of visibility/required conditions on elements, but not actually on the select other element.

first_page:
  '#type': wizard_page
  '#title': 'First page'
  standard_select_question:
    '#type': select
    '#title': 'Standard select question'
    '#options': yes_no
    '#required': true
second_page:
  '#type': wizard_page
  '#title': 'Second page'
  do_you_want_to_answer_the_next_question:
    '#type': select
    '#title': 'Do you want to answer the next question'
    '#options': yes_no
  select_with_other_question:
    '#type': select_other
    '#title': 'Select with other question'
    '#options': yes_no
    '#other__option_label': Other
    '#other__placeholder': 'Please enter the preferred pronoun'
    '#states':
      visible:
        ':input[name="do_you_want_to_answer_the_next_question"]':
          value: 'Yes'
third_page:
  '#type': wizard_page
  '#title': 'Third page'
  computed_tokens:
    '#type': computed_token
    '#title': 'Computed tokens'
    '#mode': text
    '#template': '"[webform_submission:values:standard_select_question]","[webform_submission:values:do_you_want_to_answer_the_next_question]","[webform_submission:values:select_with_other_question]"'
    '#store': true
🇬🇧United Kingdom alangallery

Been using this patch fine on several sites now. Simple addition to the UI that helps for editors - worth committing

Production build 0.71.5 2024