I loaded the newest beta release of the code and noticed that my site which was already heavily using conditional fields seemed to stop working. Specifically, the fields that were being disabled/enabled conditionally were not working. A quick look at the conditional_fields.js code revealed the problem. In the following code copied from the beta release:

if (Drupal.settings.ConditionalFields.ui_settings == 'disable') {
  var disabled = '';
  if (showOrHide == 'hide') {
    disabled = '';
  }
  toSwitch.find('textarea, input, select').attr('disabled', disabled);
}

The variable disabled is initialized to the empty string, but it is never set to 'disabled'. This results in the controlled fields not getting the disabled property set.

Obviously the fix is:

if (Drupal.settings.ConditionalFields.ui_settings == 'disable') {
  var disabled = '';
  if (showOrHide == 'hide') {
    disabled = 'disabled';
  }
  toSwitch.find('textarea, input, select').attr('disabled', disabled);
}

The only reason I can think of that this has yet to be found by someone else is that not too many others are using the disable feature.

CommentFileSizeAuthor
#2 javascript_disabling.patch585 bytesmitchell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

flapsjack’s picture

Title: Javascript disabling will not work in current version » Javascript disabling will not work in current version (6.x-1.0-beta1)
mitchell’s picture

Priority: Critical » Normal
Status: Active » Needs review
FileSize
585 bytes

Here's a patch

peterpoe’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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