Form #states in paragraph inside paragraph

Created on 24 May 2019, about 5 years ago
Updated 10 May 2023, about 1 year ago

I have a paragraph inside another, I am using #states to control the subparagraph fields based on a paragraph dropdown field.

It all works fine for the first item, if I add a new item for the sub-paragraph, for all the new items the #states wont work, except if I save the node, edit it, then it will.

Looks like when the drupal core JS kicks in for a paragraph (in my case the parent) it all works fine. But an ajax triggered by the sub-paragraph, it will not.

I attached an image to better show the scenario. The Variation field should hide/show fields inside the ITEM block, where there is a title, description and far bellow (not in the image) image and video fields.
When I add a new MEDIA ITEM, #states doesnt work. Only by editing a already existent media items (as many as it have).

Would this be a core issue? a paragraph issue? Not sure. Trying to figure out a way to patch it. I might need to look deep into #states and write my one JS code to sort this out.

💬 Support request
Status

Active

Version

1.8

Component

Code

Created by

🇧🇷Brazil afeijo Porto Alegre

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India irohit786 New Delhi

    Hi, I'm facing the same issue as mentioned above. I have a paragraph field inside another paragraph. inside the nested paragraph I have a text field which is conditionally mandatory.
    At first page load states work as expected. But when i click add more button to add a new nested paragraph, the states stop working.
    When I reload the page or ,changes the dropdown again (on which my text field is dependent) the states work again, so looks like the issue is with adding a new paragraph. Any suggestions?

Production build 0.69.0 2024