You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jh...@apache.org on 2007/08/15 16:35:20 UTC

svn commit: r566190 - /struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/validation.js

Author: jholmes
Date: Wed Aug 15 07:35:19 2007
New Revision: 566190

URL: http://svn.apache.org/viewvc?view=rev&rev=566190
Log:
WW-2058 Client side validation in xhtml template and clearErrorMessages not working in firefox with hidden fields

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

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/validation.js
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/validation.js?view=diff&rev=566190&r1=566189&r2=566190
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/validation.js (original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/validation.js Wed Aug 15 07:35:19 2007
@@ -21,11 +21,19 @@
 
 function clearErrorMessages(form) {
 
-    var table = form.childNodes[1];
-    if( typeof table == "undefined" ) {
-        table = form.childNodes[0];
+    // get field table
+    var table;
+    for (var i = 0; i < form.childNodes.length; i++) {
+        if (form.childNodes[i].tagName != null && form.childNodes[i].tagName.toLowerCase() == 'table') {
+            table = form.childNodes[i];
+            break;
+        }
     }
 
+    if (table == null) {
+        return;
+    }
+    
     // clear out any rows with an "errorFor" attribute
     var rows = table.rows;
     var rowsToDelete = new Array();