- Issue created by @matask
- π±πΉLithuania matask Vilnius
I am uploading the proposed solution with item-element-is-not-displayed.patch.
In the
WebformElement/Item.php
class, thebuildHtml
method is rewritten to remove#states
:public function buildHtml(array $element, WebformSubmissionInterface $webform_submission, array $options = []) { // Remove #states. unset($element['#states']); return parent::buildHtml($element, $webform_submission, $options); }
Please submit this as a merge request so the bots can test it. Even though π Make tests pass Active exists we need to know if there are new failures. This itself may need some regression tests added.
- π±πΉLithuania matask Vilnius
Upon further review and thorough testing, the
item-element-is-not-displayed.patch
mentioned in comment #2 does not resolve the issue. - πΊπΈUnited States jrockowitz Brooklyn, NY
Whether the item has #states does not impact whether an item is visible on view.
You need to explicitly state the item should be visible when viewed via
#display_on': both
check_this_to_show_the_item: '#type': checkbox '#title': 'Check this to show the Item' item: '#type': item '#title': Item '#states': visible: ':input[name="check_this_to_show_the_item"]': checked: true '#display_on': both '#markup': '<p>This is the item to be shown.</p>'
- π±πΉLithuania matask Vilnius
Thank you for your suggestion to use
#display_on: both
. However, the issue still persists. Despite setting all Item elements with#display_on: both
, they are not displayed in the preview pane.I have double-checked the configuration to ensure that the
#display_on
property is correctly set for all Item elements. I've also attached the test form's configuration and screenshots illustrating the problem.checbox: '#type': checkbox '#title': Checbox checbox_item: '#type': item '#title': 'Checbox item' '#states': visible: ':input[name="checbox"]': checked: true '#display_on': both '#markup': '<p>Information when checkbox is checked.</p>'
Could you please advise on any additional steps I might need to take to resolve this issue?
Thank you for your assistance.