You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by da...@apache.org on 2008/09/06 01:30:16 UTC

svn commit: r692578 - /struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js

Author: davenewton
Date: Fri Sep  5 16:30:16 2008
New Revision: 692578

URL: http://svn.apache.org/viewvc?rev=692578&view=rev
Log:
Added check for element's existence when adding error class to field label; it was broken when an element used "simple" theme. Gotta change some client-side validation stuff.

Modified:
    struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js

Modified: struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js?rev=692578&r1=692577&r2=692578&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js (original)
+++ struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js Fri Sep  5 16:30:16 2008
@@ -128,8 +128,10 @@
         //if labelposition is 'top' the label is on the row above
         var labelRow = row.cells.length > 1 ? row : StrutsUtils.previousElement(tr, "tr");
         var label = labelRow.cells[0].getElementsByTagName("label")[0];
-        label.setAttribute("class", "errorLabel");
-        label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
+        if (label) {
+            label.setAttribute("class", "errorLabel");
+            label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
+        }
     } catch (e) {
         alert(e);
     }