Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To reproduce:
- Create term reference field with any select (or other) widget
- In a module implement hook_form_alter and set
$form[field_name]['#disabled'] = TRUE;
- When viewing the form, one can still interact with the widget, even though examining the $form array, the field has our defined #disabled element.
Comment | File | Size | Author |
---|---|---|---|
#4 | fapi_disabled_state-2407567-4.patch | 1.77 KB | legolasbo |
Comments
Comment #1
legolasboI'm unable to reproduce this on the latest 7.x-3.x-dev.
Comment #2
gbyte CreditAttribution: gbyte commentedI just grabbed a fresh instance of Drupal 7.32 and reproduced the issue (as described above) on the latest dev as well.
Found out however that when using
$form[field_name]['und']['#disabled'] = TRUE;
instead of
$form[field_name]['#disabled'] = TRUE;
the field gets disabled correctly.
That seems inconsequent as disabling regular select list widgets works with the second example.
Feel free to close the issue if this is intended.
Comment #3
legolasboThis time I was able to reproduce the issue. Will look into what's causing it.
Comment #4
legolasboAttached patch should fix the problem.
Since the initial commit, #disabled was handled by the module. I'm no expert on Drupal 6, but in Drupal 7, FAPI handles this.
Comment #5
legolasbo