Roundup Tracker - Issues

Message1526

Author mstarzyk
Recipients
Date 2004-12-15.20:43:05
Message-id
In-reply-to
Logged In: YES 
user_id=657380

When there are several checkboxes on the page, they are 
available as an array in javascript. When there is only 
one checkbox, then it is just a checkbox object. The 
current javascript assumes it is always an array, and that 
is why it does not work for one element. 
Here is a patch:

Index: templates/classic/html/help_controls.js
=====================================
==============================
RCS file: /cvsroot/roundup/roundup/templates/classic/
html/help_controls.js,v
retrieving revision 1.8
diff -u -r1.8 help_controls.js
--- templates/classic/html/help_controls.js	15 Oct 2004 
00:48:05 -0000	1.8
+++ templates/classic/html/help_controls.js	15 Dec 
2004 20:32:29 -0000
@@ -17,16 +17,30 @@
 function determineList() {
     // generate a comma-separated list of the checked 
items
     var list = new String('');
-    for (box=0; box < document.frm_help.check.length; 
box++) {
-        if (document.frm_help.check[box].checked) {
-            if (list.length == 0) {
-                separator = '';
-            }
-            else {
-                separator = ',';
+
+    // either a checkbox object or an array of checkboxes
+    var check = document.frm_help.check;
+
+    if ((check.length == undefined) && 
+        (check.checked != undefined)) {
+        // only one checkbox on page
+        if (check.checked) {
+            list = check.value;
+        }
+    }
+    else {
+        // array of checkboxes
+        for (box=0; box < check.length; box++) {
+            if (check[box].checked) {
+                if (list.length == 0) {
+                    separator = '';
+                }
+                else {
+                    separator = ',';
+                }
+                // we used to use an Array and push / join, 
but IE5.0 sux
+                list = list + separator + check[box].value;
             }
-            // we used to use an Array and push / join, but 
IE5.0 sux
-            list = list + separator + document.frm_help.
check[box].value;
         }
     }
     return list;  
History
Date User Action Args
2009-02-03 14:21:01adminlinkissue1064716 messages
2009-02-03 14:21:01admincreate