In the "disabled" state change handler, a "form-element" class is needlessly filtered out from the result set (which contains only one target element anyway). This is useless, since the class "form-element" doesn't exist, so I presume this is a leftover from some pre-initial commit testing.

File: misc/states.js
Steps to reproduce: always.

Patch in comment #1.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

peterpoe’s picture

rommelxcastro’s picture

hi, is this open or closed?

andypost’s picture

Priority: Minor » Normal
Issue tags: +Needs backport to D7

This patch solves only a patch of trouble, the disabled element is DIV but disabled attribute affects only inputs

andypost’s picture

Status: Needs work » Needs review
FileSize
685 bytes

Patch includes #1 and also extends disbled attribute to all (select, input, textarea) inside disabled element

This changes behaviuor to actially disable all sub-inputs of element but currently it just colorize inputs with patch #1, default behaviour is broken

Status: Needs review » Needs work

The last submitted patch, 1263302-states-disabled-d78-4.patch, failed testing.

andypost’s picture

Status: Needs review » Needs work
FileSize
705 bytes

Re-roll for D8

andypost’s picture

Status: Needs work » Needs review
valthebald’s picture

Could you please provide some tips on what is the problem and how patch solves it? I would like to review the patch, but don't know how to compare behavior before and after the patch

andypost’s picture

Currently the states system has ability to disable elements but actually no disable is happens (just a visual styling)
My patch tries to change his to actual disable of elements

valthebald’s picture

Status: Needs review » Reviewed & tested by the community

Since I don't see any viable way to make this part of any test, and patch looks fine, RTBC

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 8.x. Thanks!

Marking for backport.

andypost’s picture

Status: Patch (to be ported) » Needs review
FileSize
685 bytes

Re-roll for D7

valthebald’s picture

Status: Needs review » Reviewed & tested by the community

Same as in 8.x

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x as well. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Mac_Weber’s picture

Status: Closed (fixed) » Active

if the form #type is set to "hidden" then it is not disabling. I tested changing the #type to textfield and it worked fine.

David_Rothstein’s picture

Title: States API disabled state handler filters out nonexistent class "form-element" » States API disabled state handler filters out nonexistent class "form-element" and doesn't disable certain form element types
Issue tags: +7.17 release notes

@Mac_Weber, what do you mean exactly - are you saying this patch introduced a regression?

(I'm not sure the use case for client-side disabling of a hidden element, but maybe there's something I'm not thinking of.)

In any case, this fix looks a bit broader than the original issue title, so I'm changing that and also mentioning this in CHANGELOG.txt and the release notes.

Mac_Weber’s picture

@David_Rothstein the behavior before this patch is the same as after patching, regarding disabling hidden elements.

I have right now a use case I managed using custom JS to disable this element, yet it would be nice to use the Drupal API to do it. My use case: I have a checkbox which gives the use a option to send some facetapi filters or just make a whole new search. These filters in my use case are sent using hidden input, which I need to disable in order to clear them if the checkbox is unset.

David_Rothstein’s picture

Status: Active » Closed (fixed)

Hm, interesting, thanks.

Since it doesn't seem directly related to the patch that was already committed in this issue, I think it would make more sense for you to create a new issue (feature request) for that functionality. That way it can start fresh as a separate issue. Of course feel free to post a link to it here, though.

Mac_Weber’s picture