
require(['jquery'], function($) {
	console.debug("Injecting JS to disable dropdown")
	$(window).load(function() {
		console.debug("Detecting if jenkins server config is locked or not")
		locked = $("#isJenkinsServerLocked")
		if (locked.text() == "locked") {
			console.debug("Locking dropdown")
			dd = $("#jenkinsServerName")
			// FINALLY figured this out via http://stackoverflow.com/questions/10570070/how-to-disable-enable-select-field-using-jquery
			dd.prop('disabled', 'disabled')
			dd.parent().append("<font color=\"red\">Cannot change Jenkin Server - LOCKED to admins only</font>")
		}
	})
})
@@ -595,11 +595,1181 @@
 %0A%09%09%7D
+%0A%0A    /*%0A      The map of what checkbox disables which fields/checkboxes.%0A         ID_OF_CHECKBOX =%3E %5B ID_OF_FORM_ELEMENT_1, ID_OF_FORM_ELEMENT_2, ... %5D%0A    */%0A    var disableMap = %7B%0A      %22isPublishPinned%22 : %5B %22publishLabel%22 %5D,%0A      %22isVerifyPinned%22 : %5B %22verifyLabel%22 %5D,%0A      %22isJunit%22 : %5B %22junitPath%22 %5D,%0A      %22isEmailNotificationsEnabled%22 : %5B %22emailRecipients%22, %22isEmailForEveryUnstableBuild%22,%0A                                        %22isEmailSendToIndividuals%22, %22isEmailPerModuleEmail%22 %5D%0A    %7D;%0A%0A    $.each(disableMap, function ( enabler, enablees ) %7B%0A      if ($(%22#%22 + enabler).is(%22:checked%22)) %7B%0A        $.each ( enablees, function (i) %7B%0A          $(%22#%22 + enablees%5Bi%5D).prop(%22disabled%22, false);%0A        %7D);%0A      %7D else %7B%0A        $.each ( enablees, function (i) %7B%0A          $(%22#%22 + enablees%5Bi%5D).prop(%22disabled%22, true);%0A        %7D);%0A      %7D%0A%0A      $(%22#%22 + enabler).change(function () %7B%0A        $.each ( disableMap%5Benabler%5D, function (i) %7B%0A          if ( $(%22#%22 + enabler).is(%22:checked%22)) %7B%0A            $(%22#%22 + enablees%5Bi%5D).prop(%22disabled%22, false);%0A          %7D else %7B%0A            $(%22#%22 + enablees%5Bi%5D).prop(%22disabled%22, true);%0A          %7D%0A        %7D);%0A      %7D);%0A    %7D);%0A%0A
 %0A%09%7D)%0A%7D)
+%0A

Add disable/enable logic for grouped form elements