Download & Extend

States API disabled state handler filters out nonexistent class "form-element" and doesn't disable certain form element types

Project:Drupal core
Version:7.x-dev
Component:javascript
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:7.17 release notes, FAPI #states, needs backport to D7

Issue Summary

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.

Comments

#1

Patch.

AttachmentSizeStatusTest resultOperations
states-remove-form-element-filter-1263302-1.patch466 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 32,858 pass(es).View details

#2

hi, is this open or closed?

#3

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

#4

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

AttachmentSizeStatusTest resultOperations
1263302-states-disabled-d78-4.patch685 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1263302-states-disabled-d78-4.patch. Unable to apply patch. See the log in the details link for more information.View details

#5

Status:needs review» needs work

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

#6

Re-roll for D8

AttachmentSizeStatusTest resultOperations
1263302-states-disabled-5.patch705 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,291 pass(es).View details

#7

Status:needs work» needs review

#8

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

#9

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

#10

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

#11

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.

#12

Status:patch (to be ported)» needs review

Re-roll for D7

AttachmentSizeStatusTest resultOperations
1263302-states-disabled-12.patch685 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 39,544 pass(es).View details

#13

Status:needs review» reviewed & tested by the community

Same as in 8.x

#14

Status:reviewed & tested by the community» fixed

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

#15

Status:fixed» closed (fixed)

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

#16

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.

#17

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.

#18

@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.

#19

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.

#20