Can't use image field as a dependee

Created on 2 July 2018, over 6 years ago
Updated 1 July 2024, 5 months ago

I have two fields.

1. Image field
2. Text field.

When the image field is filled, I want to show the text field. When the image is removed, the text field should be hidden.

This works fine with other types of fields, but if the image field is the dependee, nothing happens. The text field is always visible. When I look at the html of the dependent text field, this is what I see:

<div class="field--type-string-long field--name-field-news-caption field--widget-string-textarea js-form-wrapper form-wrapper" data-drupal-selector="edit-field-news-caption-wrapper" data-drupal-states="{"visible":{"[name=\u0022field_news_image_0_upload_button\u0022]":{"!empty":true}}}" id="edit-field-news-caption-wrapper">      
<div class="form-group isu-form-group isu-form-type_textarea js-form-item form-item js-form-type-textarea form-item-field-news-caption-0-value js-form-item-field-news-caption-0-value">

Have a look at the data-drupal-states attribute. That looks sticky.

This is for Drupal 8. Thanks

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States sacarney

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.

Production build 0.71.5 2024