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.
Comment | File | Size | Author |
---|---|---|---|
#2 | javascript_disabling.patch | 585 bytes | mitchell |
Comments
Comment #1
flapsjack CreditAttribution: flapsjack commentedComment #2
mitchell CreditAttribution: mitchell commentedHere's a patch
Comment #3
peterpoe CreditAttribution: peterpoe commentedCommitted, thanks.