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?).

CommentFileSizeAuthor
conditional_fields_disable_fail.patch559 bytesaron novak

Comments

peterpoe’s picture

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" and doesn't disable certain form element types
3. Fixed the "required" and "checked" states too, which also stopped working recently.

Thanks!

Status: Fixed » Closed (fixed)

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