Currently it is not possible to add any element as a child to container of type item:
Steps to reproduce:
- Add container element of type item to form
- Try to add via drag and drop any element to this container
You will also notice, that the button "add element" is not present for containers of type item.
This does not seem to be a general container issue. Adding childs to container of type details is still working.
I'm aware of this bug since update to webform 8.x-5.0-rc1, but it is also reproducable in 8.5.x-beta25. In 8.5.x-beta24 everything works fine.
Another bug, which might be related to it (I'm not sure if I should open a separate issue): Submitted values of existing childs of container elements of type item are not rendered in email body. Instead the form inputs are displayed.
(This is a webform with container item and some text input elements, which has been created before update to 8.x-5.0-rc1)
When this form is submitted and it's email going to be sent, the following php notice is logged:
Notice: Undefined index: #value in template_preprocess_textarea() (Zeile 383 in /var/www/html/master/htdocs/core/includes/form.inc)
Comment | File | Size | Author |
---|---|---|---|
#11 | 2937629-11.patch | 5.46 KB | jrockowitz |
| |||
#10 | 2937629-9.patch | 4.83 KB | jrockowitz |
#8 | Screen Shot 2018-01-18 at 9.21.11 PM.png | 82.29 KB | jrockowitz |
#8 | 2937629-7.patch | 665 bytes | jrockowitz |
container-childs-not-rendered.jpg | 10.26 KB | pminf |
Comments
Comment #2
pminfComment #3
pminfComment #4
pminfComment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThis change, maybe regression, was caused by #2932040: Nested webform elements not showing in HTML results.
I missed that 'Item' elements are considered markup.
Now that there is a "Section' element maybe 'Item' elements should remain as markup.
Comment #6
pminfYou mean we should change all existing elements of type "item" to "section"? I'm OK with that if the rendered result remains the same. But this should be done automatically on update.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYes, I think changing all 'item' elements to 'section' is the best approach.
I am hesitant to write an update hook that alters the markup and layout of peoples forms. Keep in mind that the Webform module was still in beta when this change occurred. The update hook would have to alter any form markup elements that are being used as a container.
Another option would be to write an update hook that validates all the webforms and displays a warning, maybe on the Status report.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch fixes the YAML source validation so that errors are displayed if the hierarchy of a webform is broken.
I am going to also add webform validation checking the `drush webform-repair command`.
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThis patch adds element validation the `drush webform-repair` command. I am going to have to investigate some of these errors I am seeing in the 180+ test forms.
@pminf This patch with the command should tell you where are the element hierarchy issues are.
The remaining question is should we provide an update hook that warns people about this issue?
Comment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI am not sure we can use an update hook to tell people that there are elements are invalid.
The attached patch will cause an error to be displayed anytime the elements are re-saved.
Comment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI applied the patch and published a change record.
Comment #16
pminf@jrockowitz, sorry for my late replay! I've tested your latest patch by using 8.x-5.0-rc2 and I do get the error message when saving an element which is nested inside an item (cool!). But I do not get an error message when I save the whole form which does still contain nested elements inside items. This wrongly gives the impression that everything is valid.