Commit cbbcceb2 authored by Reed Loden's avatar Reed Loden

Bug 179626 - Hide, rather than disable, requestee fields when the flags aren't in the "?" state.

[r=mkanat a=mkanat]
parent 86f63e23
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
// Enables or disables a requestee field depending on whether or not // Shows or hides a requestee field depending on whether or not
// the user is requesting the corresponding flag. // the user is requesting the corresponding flag.
function toggleRequesteeField(flagField, no_focus) function toggleRequesteeField(flagField, no_focus)
{ {
...@@ -34,18 +34,18 @@ function toggleRequesteeField(flagField, no_focus) ...@@ -34,18 +34,18 @@ function toggleRequesteeField(flagField, no_focus)
var requesteeField = document.getElementById(id); var requesteeField = document.getElementById(id);
if (!requesteeField) return; if (!requesteeField) return;
// Enable or disable the requestee field based on the value // Show or hide the requestee field based on the value
// of the flag field. // of the flag field.
if (flagField.value == "?") { if (flagField.value == "?") {
requesteeField.disabled = false; YAHOO.util.Dom.removeClass(requesteeField.parentNode, 'bz_default_hidden');
if (!no_focus) requesteeField.focus(); if (!no_focus) requesteeField.focus();
} else } else
requesteeField.disabled = true; YAHOO.util.Dom.addClass(requesteeField.parentNode, 'bz_default_hidden');
} }
// Disables requestee fields when the window is loaded since they shouldn't // Hides requestee fields when the window is loaded since they shouldn't
// be enabled until the user requests that flag type. // be enabled until the user requests that flag type.
function disableRequesteeFields() function hideRequesteeFields()
{ {
var inputElements = document.getElementsByTagName("input"); var inputElements = document.getElementsByTagName("input");
var selectElements = document.getElementsByTagName("select"); var selectElements = document.getElementsByTagName("select");
...@@ -68,8 +68,8 @@ function disableRequesteeFields() ...@@ -68,8 +68,8 @@ function disableRequesteeFields()
id = inputElement.name.replace(/requestee(_type)?-(\d+)/, "flag$1-$2"); id = inputElement.name.replace(/requestee(_type)?-(\d+)/, "flag$1-$2");
flagField = document.getElementById(id); flagField = document.getElementById(id);
if (flagField && flagField.value != "?") if (flagField && flagField.value != "?")
inputElement.disabled = true; YAHOO.util.Dom.addClass(inputElement.parentNode, 'bz_default_hidden');
} }
} }
} }
YAHOO.util.Event.addListener(window, "load", disableRequesteeFields); YAHOO.util.Event.onDOMReady(hideRequesteeFields);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment