summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorTiago Mello <timello@gmail.com>2010-08-27 05:27:08 +0200
committerTiago Mello <timello@gmail.com>2010-08-27 05:27:08 +0200
commit0844fe9fc6d2d5293fad1384d2955dedf30fc8c4 (patch)
tree636a0bbcdf71017fda712e60cd1a0dc1b7038b7b /js
parentd94865b30a92be8a3a900f8d1d8262d36044b1ca (diff)
downloadbugzilla-0844fe9fc6d2d5293fad1384d2955dedf30fc8c4.tar.gz
bugzilla-0844fe9fc6d2d5293fad1384d2955dedf30fc8c4.tar.xz
Bug 479400: Add the ability to show or hide particular custom fields
based on multiple values of another field (visibility controllers) r/a=mkanat
Diffstat (limited to 'js')
-rw-r--r--js/field.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/js/field.js b/js/field.js
index a64369d33..8e1f53991 100644
--- a/js/field.js
+++ b/js/field.js
@@ -465,12 +465,12 @@ function setClassification() {
* a certain value. May only be called after the controller has already
* been added to the DOM.
*/
-function showFieldWhen(controlled_id, controller_id, value) {
+function showFieldWhen(controlled_id, controller_id, values) {
var controller = document.getElementById(controller_id);
// Note that we don't get an object for "controlled" here, because it
// might not yet exist in the DOM. We just pass along its id.
- YAHOO.util.Event.addListener(controller, 'change',
- handleVisControllerValueChange, [controlled_id, controller, value]);
+ YAHOO.util.Event.addListener(controller, 'change',
+ handleVisControllerValueChange, [controlled_id, controller, values]);
}
/**
@@ -480,13 +480,21 @@ function showFieldWhen(controlled_id, controller_id, value) {
function handleVisControllerValueChange(e, args) {
var controlled_id = args[0];
var controller = args[1];
- var value = args[2];
+ var values = args[2];
var label_container =
document.getElementById('field_label_' + controlled_id);
var field_container =
document.getElementById('field_container_' + controlled_id);
- if (bz_valueSelected(controller, value)) {
+ var selected = false;
+ for (var i = 0; i < values.length; i++) {
+ if (bz_valueSelected(controller, values[i])) {
+ selected = true;
+ break;
+ }
+ }
+
+ if (selected) {
YAHOO.util.Dom.removeClass(label_container, 'bz_hidden_field');
YAHOO.util.Dom.removeClass(field_container, 'bz_hidden_field');
}