Download & Extend

states.js should handle elements even if the state is applied to a container

Project:Conditional Fields
Version:7.x-3.x-dev
Component:Javascript
Category:bug report
Priority:major
Assigned:Aron Novak
Status:closed (fixed)

Issue Summary

At the moment, the JS tries to set disabled attribute on outer DIV, not the form element itself. With finding the children HTML form element, i could make it work (again?).

AttachmentSize
conditional_fields_disable_fail.patch559 bytes

Comments

#1

Title:Fails to disable form elements» states.js should handle elements even if the state is applied to a container
Status:needs review» fixed

Committed with three changes:

1. I inverted the order of the selection, so the state will continue to work when it's applied directly to the form element:

      $(e.target).closest('.form-item, .form-submit, .form-wrapper')[e.value ? 'addClass' : 'removeClass']('form-disabled')
      .find('input, select, textarea, button')
        .attr('disabled', e.value);

2. Removed the useless .filter('form-element') and filed a bug about it: #1263302: States API disabled state handler filters out nonexistent class "form-element"
3. Fixed the "required" and "checked" states too, which also stopped working recently.

Thanks!

#2

Status:fixed» closed (fixed)

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

nobody click here