Author: jholmes Date: Wed Aug 15 07:36:25 2007 New Revision: 566192 URL: http://svn.apache.org/viewvc?view=rev&rev=566192 Log: WW-2058 Client side validation in xhtml template and clearErrorMessages not working in firefox with hidden fields
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?view=diff&rev=566192&r1=566191&r2=566192 ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js (original) +++ struts/struts2/trunk/core/src/main/resources/template/xhtml/validation.js Wed Aug 15 07:36:25 2007 @@ -25,9 +25,17 @@ function clearErrorMessagesXHTML(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