From 2a7a65293ef968c41771a0b2a22b3191d6cab800 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 2 Dec 2010 19:09:16 +0000 Subject: [PATCH] disable form fields when disabling the fields. svn path=/plone.app.discussion/trunk/; revision=46087 --- .../browser/javascripts/controlpanel.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/plone/app/discussion/browser/javascripts/controlpanel.js b/plone/app/discussion/browser/javascripts/controlpanel.js index 8743c21..f48cb21 100644 --- a/plone/app/discussion/browser/javascripts/controlpanel.js +++ b/plone/app/discussion/browser/javascripts/controlpanel.js @@ -14,15 +14,19 @@ **************************************************************************/ $.disableSettings = function (settings) { $.each(settings, - function(intIndex, objValue){ - objValue.removeClass('unclickable'); + function(intIndex, setting){ + setting.addClass('unclickable'); + setting_field = $(setting).find("input,select"); + setting_field.attr('disabled', 'disabled'); }); }; $.enableSettings = function (settings) { $.each(settings, - function(intIndex, objValue){ - objValue.addClass('unclickable'); + function(intIndex, setting){ + setting.removeClass('unclickable'); + setting_field = $(setting).find("input,select"); + setting_field.removeAttr('disabled'); }); }; @@ -35,12 +39,12 @@ $(window).load(function () { /********************************************************************** - * If commenting is globally disabled, disable all commenting options. + * If commenting is disabled globally, disable all commenting options. **********************************************************************/ $("input[name='form.widgets.globally_enabled:list']").bind("change", function (e) { if ($(this).attr("checked")) { - // commenting globally enable - $.disableSettings([ + // commenting globally enabled + $.enableSettings([ $('#formfield-form-widgets-anonymous_comments'), $('#formfield-form-widgets-text_transform'), $('#formfield-form-widgets-captcha'), @@ -50,7 +54,7 @@ ]); } else { // commenting globally disabled - $.enableSettings([ + $.disableSettings([ $('#formfield-form-widgets-anonymous_comments'), $('#formfield-form-widgets-text_transform'), $('#formfield-form-widgets-captcha'),