Check for disabled attribute

Created on 1 April 2021, about 3 years ago
Updated 27 September 2023, 9 months ago

Problem/Motivation

I have a multiselect filed, that should only be allowed to change by a user having a specific group. Disabling the select form field does not disable the multiselect. Despite the select beeing disabled new values can be selected via the multiselect.

Steps to reproduce

In hook_form_alter() change a field to disabled:

$form['field_name']['widget']['#attributes']['disabled'] = TRUE;

Proposed resolution

If the select field is disabled, the buttons of the multiselct should be disabled and the whole widget should be given this grayed out disabled look.

✨ Feature request
Status

Active

Version

1.7

Component

User interface

Created by

πŸ‡©πŸ‡ͺGermany Thomas.Schnitzler

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.

  • πŸ‡¨πŸ‡ΏCzech Republic Bohus Ulrych Pilsen (Czechia)

    I have similar issue with contrib module disable_field, which can set field as disabled.
    But improved_multi_select still replace such field with it's own widget.
    My current workaround is to define selector with addition condition
    #edit-myfield:not([disabled='disabled'])

    IMHO this should be done automatically in the improved_multi_select.js

Production build 0.69.0 2024