Drupal behaviors not running when element is shown

Created on 3 April 2023, almost 2 years ago
Updated 4 April 2023, almost 2 years ago

Drupal behaviors are not being attached on elements that are shown.

A use case of this that I'm running into with the Chosen module :

  • The multiselect field (a list of states) is hidden by default
  • When I change the value of another field, the Conditional Fields module then shows this multiselect field
  • However, the chosen JavaScript is not run against the recently shown field.
🐛 Bug report
Status

Needs review

Version

4.0

Component

Javascript

Created by

🇺🇸United States mherchel Gainesville, FL, US

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

Comments & Activities

  • Issue created by @mherchel
  • Status changed to Needs review almost 2 years ago
  • 🇺🇸United States mherchel Gainesville, FL, US

    Patch attached.

  • 🇺🇸United States mherchel Gainesville, FL, US
  • 🇮🇳India saurabh-2k17

    @mherchel thanks for this patch, I am facing similar problem. On page load, the "Target field" (Text field) is not being shown even if the "Controlled By" field (Select List) value is set to show the "Target field" but once I change the value of the select list field it removes the style="display: none;" attribute, which displays the hidden field.

    Sadly, the patch is not covering the aspect which I am mentioning.

Production build 0.71.5 2024