svn commit: r1078966 - /struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js
Author: jogep Date: Mon Mar 7 21:44:34 2011 New Revision: 1078966 URL: http://svn.apache.org/viewvc?rev=1078966&view=rev Log: WW-3395: Client Validation don't display Global Messages Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js?rev=1078966&r1=1078965&r2=1078966&view=diff == --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js (original) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/utils.js Mon Mar 7 21:44:34 2011 @@ -32,24 +32,50 @@ StrutsUtils.getValidationErrors = functi }; StrutsUtils.clearValidationErrors = function(form) { - var firstNode = StrutsUtils.firstElement(form); - var xhtml = firstNode.tagName.toLowerCase() == "table"; - - if(xhtml) { -clearErrorMessagesXHTML(form); -clearErrorLabelsXHTML(form); - } else { -clearErrorMessagesCSS(form); -clearErrorLabelsCSS(form); - } -}; +var firstNode = StrutsUtils.firstElement(form); +var xhtml = firstNode.tagName.toLowerCase() == "table"; + +if(xhtml) { +clearErrorMessagesXHTML(form); +clearErrorLabelsXHTML(form); +} else { +clearErrorMessagesCSS(form); +clearErrorLabelsCSS(form); +} + +//clear previous global error messages + if(StrutsUtils.errorLists[form] && StrutsUtils.errorLists[form] !== null) { + form.parentNode.removeChild(StrutsUtils.errorLists[form]); + StrutsUtils.errorLists[form] = null; + } + +}; + +StrutsUtils.errorLists = []; // shows validation errors using functions from xhtml/validation.js // or css_xhtml/validation.js StrutsUtils.showValidationErrors = function(form, errors) { - StrutsUtils.clearValidationErrors(form, errors); +StrutsUtils.clearValidationErrors(form, errors); + + if (errors.errors) { + var errorList = document.createElement("ul"); + errorList.setAttribute("class", "errorMessage"); + errorList.setAttribute("className", "errorMessage"); // ie hack cause ie does not support setAttribute + + for ( var l = 0; l < errors.errors.length; l++) { + var item = document.createElement("li"); + var itemText = document.createTextNode(errors.errors[l]); + item.appendChild(itemText); + + errorList.appendChild(item); + } + + form.parentNode.insertBefore(errorList, form); + StrutsUtils.errorLists[form] = errorList; + } - var firstNode = StrutsUtils.firstElement(form); + var firstNode = StrutsUtils.firstElement(form); var xhtml = firstNode.tagName.toLowerCase() == "table"; if(errors.fieldErrors) { for(var fieldName in errors.fieldErrors) {
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache ActiveMQ (https://cwiki.apache.org/confluence/display/ACTIVEMQ) Pages - Wildcards edited by dejanb (08:50 AM) https://cwiki.apache.org/confluence/display/ACTIVEMQ/Wildcards Apache Connectors Framework (https://cwiki.apache.org/confluence/display/CONNECTORS) Pages - Books created by kwri...@metacarta.com (08:09 PM) https://cwiki.apache.org/confluence/display/CONNECTORS/Books Index edited by kwri...@metacarta.com (08:11 PM) https://cwiki.apache.org/confluence/display/CONNECTORS/Index Apache CXF (https://cwiki.apache.org/confluence/display/CXF) Pages - People edited by mazzag (09:52 AM) https://cwiki.apache.org/confluence/display/CXF/People Apache CXF Documentation (https://cwiki.apache.org/confluence/display/CXF20DOC) Pages - Migration Guides edited by dkulp (10:14 AM) https://cwiki.apache.org/confluence/display/CXF20DOC/Migration+Guides 3.0 Migration Guide created by dkulp (10:12 AM) https://cwiki.apache.org/confluence/display/CXF20DOC/3.0+Migration+Guide Apache Felix (https://cwiki.apache.org/confluence/display/FELIX) Pages - Board Report (2011-03) edited by cziege...@apache.org (09:44 AM) https://cwiki.apache.org/confluence/display/FELIX/Board+Report+%282011-03%29 news edited by cziege...@apache.org (09:43 AM) https://cwiki.apache.org/confluence/display/FELIX/news downloads edited by cziege...@apache.org (09:41 AM) https://cwiki.apache.org/confluence/display/FELIX/downloads Apache Geronimo Development (https://cwiki.apache.org/confluence/display/GMOxDEV) Pages - Mega Index edited by kevan (10:52 AM) https://cwiki.apache.org/confluence/display/GMOxDEV/Mega+Index Apache Geronimo v2.1 (https://cwiki.apache.org/confluence/display/GMOxDOC21) Pages - Deploy and Run a Java EE Application Client edited by kevan (11:00 AM) https://cwiki.apache.org/confluence/display/GMOxDOC21/Deploy+and+Run+a+Java+EE+Application+Client Apache Geronimo v2.1 User's guide development status edited by kevan (10:59 AM) https://cwiki.apache.org/confluence/display/GMOxDOC21/Apache+Geronimo+v2.1+User%27s+guide+development+status Documentation edited by kevan (10:58 AM) https://cwiki.apache.org/confluence/display/GMOxDOC21/Documentation Apache Geronimo v2.2 (https://cwiki.apache.org/confluence/display/GMOxDOC22) Pages - Deploying and running Java EE application client edited by kevan (11:32 AM) https://cwiki.apache.org/confluence/display/GMOxDOC22/Deploying+and+running+Java+EE+application+client Apache Geronimo v3.0 (https://cwiki.apache.org/confluence/display/GMOxDOC30) Pages - Apache Geronimo v3.0 documentation development status edited by chirun...@gmail.com (09:59 PM) https://cwiki.apache.org/confluence/display/GMOxDOC30/Apache+Geronimo+v3.0+documentation+development+status Naming (JNDI) edited by chirun...@gmail.com (09:19 PM) https://cwiki.apache.org/confluence/display/GMOxDOC30/Naming+%28JNDI%29 Creating your keystorefile for SSL authentication edited by chirun...@gmail.com (08:46 PM) https://cwiki.apache.org/confluence/display/GMOxDOC30/Creating+your+keystorefile+for+SSL+authentication Apache Mahout (https://cwiki.apache.org/confluence/display/MAHOUT) Pages - Who We Are edited by dlyubi...@apache.org (06:24 PM) https://cwiki.apache.org/confluence/display/MAHOUT/Who+We+Are Collections edited by daisuke (06:57 AM) https://cwiki.apache.org/confluence/display/MAHOUT/Collections Issue Tracker edited by daisuke (06:30 AM) https://cwiki.apache.org/confluence/display/MAHOUT/Issue+Tracker Patch Check List edited by daisuke (06:16 AM) https://cwiki.apache.org/confluence/display/MAHOUT/Patch+Check+List Apache OpenNLP (https://cwiki.apache.org/confluence/display/OPENNLP) Pages - TestPlan1.5.1 edited by co...@apache.org (10:05 AM) https://cwiki.apache.org/confluence/display/OPENNLP/TestPlan1.5.1 Apache Shiro (https://cwiki.apache.org/confluence/display/SHIRO) Pages - Articles edited by lhazlewood (11:50 PM) https://cwiki