Problem/Motivation
Hello,
When I save a nested layout paragraph with empty required field, required error appear but after fill the field, the dialog is broken and opens in full page on page url : /layout-paragraphs-builder/[Nested-paragraph-uuid]/choose-component
=> This makes it impossible to save the paragraph because the link with the created content is broken. (See attachment)
I don't found any issue about this !?
Steps to reproduce
1. Install a new D9.5 base (Think D10 have the same problem)
2. Create one content type "Example"
3. Create two paragraph types "First" / "Nested"
4. Add required "Title" text field to "Nested" paragraph type
5. Add field reference to "Nested" paragraph type in "First" paragraph type and use "Layout paragraphs" for form display
6. Add field reference to "First" paragraph type in "Example" content type and use "Layout paragraphs" for form display
7. Add an "Example" content, add "First" paragraph, add "Nested" paragraph, submit form without fill title field
=> Error message "Title is required" appear, this is OK but if we fill the field "Title" and re-submit, form redirects to url : /layout-paragraphs-builder/[Nested-paragraph-uuid]/choose-component => We lost the contribution of "Example" content !!
Proposed resolution
It's look like an ajax submit doesn't want to work ?
It would be necessary to analyze and create a patch in first time.
Thank you in advance for your helping.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | fix_redirect_after_validation_for_nested_dialogs-3359174-9.patch | 776 bytes | marjina-constantin |
| #7 | Nested_entity_ref_validation_error.mp4 | 726.57 KB | johntarling |
| layout-paragraphs.jpg | 53.81 KB | lilune |
Issue fork layout_paragraphs-3359174
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
Comment #2
lilune commentedHas anyone encountered the same problem ?
Comment #3
damienmckennaI've ran into some oddities with the module, I think this was one of them.
Comment #4
lolgm commentedI have the same problem.
After investigating a little, I noticed that when the validation messages for the mandatory fields of the form are shown, all open dialogs (level 1 and level 2) are replaced with the form that gave an error, which means that all open dialogs have the same content.
It seems to me that this problem is happening due to some problem updating the dialogs/forms with AJAX.
However, I was unable to identify the origin of this problem.
Comment #5
erwinvb commentedI'm having the same issue with nested paragraphs.
For example our paragraphs are filled with the content below:
Steps to reproduce:
Problem:
Both modals are getting the same data-drupal-selector value which is used to replace the modal form via the ajax command.
Solution:
Make sure the data-drupal-selector value is unique based on parents. How exactly? I don't know for now, but hopefully someone can fix this.
Comment #6
hudri@erwinvb For media entities, use the patch from https://www.drupal.org/project/drupal/issues/3345064
Comment #7
johntarling commentedHit this issue too when creating a tabbed content component in D10.2 with Layout paragraphs 2.04.
Comment #8
ninobrownh20 commentedCurrently experiencing the same issue on Drupal 10.2.4 and layout_paragraphs 2.0.4
Comment #9
marjina-constantin commentedHere is a patch with a fix.
As @erwinvb mentioned, the problem is that nested dialogs have the same data-drupal-selector attribute. Current patch adds also paragraph bundle to the attribute, to make it more unique. It will probably work for most cases, except when for some reason we have the same paragraph form opened in nested dialogs. This case will require each dialog to know how deep in the nesting level it is.
Current patch is a quick fix for the most people :)
Comment #10
anybodyJust ran into the same issue. I agree this is major and still existing in latest release.
Comment #12
sethhill commentedComment #15
sethhill commented