summaryrefslogtreecommitdiffstats
path: root/productmenu.js
diff options
context:
space:
mode:
authormyk%mozilla.org <>2004-12-14 11:29:56 +0100
committermyk%mozilla.org <>2004-12-14 11:29:56 +0100
commit5ae95ca8b945cec145387a2ef764ec46213e1818 (patch)
tree8d0ff78c4d9187fba7fc5c375971ce2f0eb1257e /productmenu.js
parentc530417076682f22af6aa1be23b25cc3b8b8fe88 (diff)
downloadbugzilla-5ae95ca8b945cec145387a2ef764ec46213e1818.tar.gz
bugzilla-5ae95ca8b945cec145387a2ef764ec46213e1818.tar.xz
Fix for bug 241814: properly trim component fields according to product selection in the request queue, flag type editing, and anywhere else that uses the same code; r=vladd, a=justdave
Diffstat (limited to 'productmenu.js')
-rw-r--r--productmenu.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/productmenu.js b/productmenu.js
index d917d325c..e633ab327 100644
--- a/productmenu.js
+++ b/productmenu.js
@@ -203,19 +203,26 @@ function selectProduct( f , productfield, componentfield, blank ) {
// - is_diff says if it's a full list or just a list of products that
// were added to the current selection.
// - single indicates if a single item was selected
+ // - selectedIndex is the index of the first selected item
+ // - selectedValue is the value of the first selected item
var sel = Array();
var is_diff = 0;
var single;
-
- // if nothing selected, pick all
- if ( f[productfield].selectedIndex == -1 ) {
- for ( var i = 0 ; i < f[productfield].length ; i++ ) {
+ var selectedIndex = f[productfield].selectedIndex;
+ var selectedValue = f[productfield].options[selectedIndex].value;
+
+ // If nothing is selected, or the selected item is the "blank" value
+ // at the top of the list which represents all products on drop-down menus,
+ // then pick all products so we show all components.
+ if ( selectedIndex == -1 || !cpts[selectedValue])
+ {
+ for ( var i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) {
sel[sel.length] = f[productfield].options[i].value;
}
single = 0;
} else {
- for ( i = 0 ; i < f[productfield].length ; i++ ) {
+ for ( i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) {
if ( f[productfield].options[i].selected ) {
sel[sel.length] = f[productfield].options[i].value;
}