diff --git a/core/src/main/resources/template/xhtml/validation.js b/core/src/main/resources/template/xhtml/validation.js index fc2f8c80b..21a8f8e5d 100644 --- a/core/src/main/resources/template/xhtml/validation.js +++ b/core/src/main/resources/template/xhtml/validation.js @@ -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();