[rhmessaging-commits] rhmessaging commits: r3302 - mgmt/trunk/cumin/resources.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Apr 16 14:10:13 EDT 2009


Author: eallen
Date: 2009-04-16 14:10:13 -0400 (Thu, 16 Apr 2009)
New Revision: 3302

Modified:
   mgmt/trunk/cumin/resources/app.js
Log:
Check for existence of forms to avoid javascript error

Modified: mgmt/trunk/cumin/resources/app.js
===================================================================
--- mgmt/trunk/cumin/resources/app.js	2009-04-16 17:43:44 UTC (rev 3301)
+++ mgmt/trunk/cumin/resources/app.js	2009-04-16 18:10:13 UTC (rev 3302)
@@ -74,18 +74,20 @@
             var hash = wooly.session.hash();
             for (var key in hash) {
                 if (!(hash[key] instanceof Function)) {
-                    var checks = document.forms[0].elements[key];
-                    if (checks) {
-                        var vals = $A(hash[key].split('|'));
-                        if (typeof checks.length == "undefined") {
-                            if (vals.contains(checks.value)) {
-                                checks.checked = true;
-                            }
-                        } else {
-                            for (var i=0; i < checks.length; i++) {
-                                if (vals.contains(checks[i].value)) {
-                                    checks[i].checked = true;
+                    if (document.forms.length > 0) {
+                        var checks = document.forms[0].elements[key];
+                        if (checks) {
+                            var vals = $A(hash[key].split('|'));
+                            if (typeof checks.length == "undefined") {
+                                if (vals.contains(checks.value)) {
+                                    checks.checked = true;
                                 }
+                            } else {
+                                for (var i=0; i < checks.length; i++) {
+                                    if (vals.contains(checks[i].value)) {
+                                        checks[i].checked = true;
+                                    }
+                                }
                             }
                         }
                     }




More information about the rhmessaging-commits mailing list