- Issue created by @NicholasS
- πΊπΈUnited States NicholasS
Looking into this yes It seems when its rendering the submissions as soon as it gets past the new submissions which had 2 text areas with a conditional field. I get this error when its rendering out a submission from the old form that only had 1 text area and not conditionally hidden fields.
Locally I could get this fixed by adding
// if value is array convert to string if (is_array($value)) { $value = implode(", ", $value); }
to
/** * {@inheritdoc} */ protected function formatHtmlItem(array $element, WebformSubmissionInterface $webform_submission, array $options = []) { $value = $this->getValue($element, $webform_submission, $options); $format = $value['format'] ?? $this->getItemFormat($element); $value = $value['value'] ?? $value; // if value is array convert to string if (is_array($value)) { $value = implode(", ", $value); } switch ($format) { case 'raw': return $value; case 'value': $default_format = filter_default_format(User::load($webform_submission->getOwnerId())); return check_markup($value, $default_format); default: return check_markup($value, $format); } }
- Status changed to Postponed: needs info
8 months ago 12:05pm 5 April 2024 - πΊπΈUnited States jrockowitz Brooklyn, NY
Can you post a very simple example webform which can be used to replicate this issue?
- πΊπΈUnited States NicholasS
Ok so diving into this a bit more over the last hour I can't reproduce the issue in a new form, but I think I have a better Idea as to what is going on.
What happened is a normal text area was "upgraded" to a WYSWIG, and it appears the same machine name was kept.
When I do this locally, and I mean
1. Delete the old text area
2. Readd the same field but as a WYSWIG fieldI don't get an error.
But I think when we exported this change to config, and migrated it to prod is it possible that the migration process did not actually clear out the old plain text submissions?
- πΊπΈUnited States NicholasS
Yeah so steps to reproduce.
1. Start with a simple text are a form and submit a test submission
elements: |- title: '#type': textfield '#title': title site_contact_details: '#type': textarea '#title': 'site contact details'
2. Then import (drush cim) a new version of that webform that makes the field become a WYSWIG text area.
elements: |- title: '#type': textfield '#title': title site_contact_details: '#type': text_format '#title': 'site contact details' '#allowed_formats': webform_html: webform_html
3. Do another test submission
4. See errror on submisison page
- πΊπΈUnited States NicholasS
So yeah I guess this was my mistake for keeping the same machine name, but also seems like a fairly common foot gun that could happen to others.
- Status changed to Closed: won't fix
8 months ago 3:30pm 5 April 2024 - πΊπΈUnited States jrockowitz Brooklyn, NY
This feels like an edge case related to changing the elements via YAML. For now, I would like to not fix it.