Update of /var/cvs/html/mmbase/validation In directory james.mmbase.org:/tmp/cvs-serv20402
Modified Files: validation.js.jsp Log Message: binaries were not correctly server side validated. This is simply not supported, so do not every try it. (It probably can be supported but it would be not very simple) See also: http://cvs.mmbase.org/viewcvs/html/mmbase/validation Index: validation.js.jsp =================================================================== RCS file: /var/cvs/html/mmbase/validation/validation.js.jsp,v retrieving revision 1.59 retrieving revision 1.60 diff -u -b -r1.59 -r1.60 --- validation.js.jsp 3 Mar 2009 15:32:35 -0000 1.59 +++ validation.js.jsp 15 Apr 2009 15:59:19 -0000 1.60 @@ -9,7 +9,7 @@ * then call validator.setup(el). * * @author Michiel Meeuwissen - * @version $Id: validation.js.jsp,v 1.59 2009/03/03 15:32:35 michiel Exp $ + * @version $Id: validation.js.jsp,v 1.60 2009/04/15 15:59:19 michiel Exp $ */ @@ -76,9 +76,10 @@ MMBaseValidator.prototype.onLoad = function(event) { - if (this.root == null) { + if (this.root == null && event != null) { this.root = event.target || event.srcElement; } + //console.log("Root" + this.root); this.addValidation(this.root); //validatePage(target); } @@ -155,7 +156,6 @@ if (typeof(path) == "string") path = path.split(/\s+/); var tagName = path.shift(); - var tag = el == null ? null : el.firstChild; while (tag != null) { if (tag.nodeType == 1) { @@ -624,7 +624,6 @@ } else { return el.value; } - } /** @@ -638,7 +637,9 @@ this.log("Unsupported element " + el); return true; // not yet supported } - if (this.isBinary(el)) return true; // not yet supported + if (this.isBinary(el)) { + return true; // not yet supported + } if (this.isRequired(el) && this.enforce(el, el.mm_isrequired_enforce)) { if (value == "") { @@ -671,8 +672,15 @@ MMBaseValidator.prototype.serverValidation = function(el) { if (el == null) return; try { + if (this.isBinary(el)) { + el.serverValidated = true; + return $("<result valid='true' />")[0]; + } + + var key = this.getDataTypeKey(el); var value = this.getDateValue(el); + var validationUrl = '<mm:url page="/mmbase/validation/valid.jspx" />'; this.getDataTypeArguments(key) + (this.lang != null ? "&lang=" + this.lang : "") + @@ -694,7 +702,8 @@ result = res.responseXML; //console.log("" + res); } else { - result = $("<result valid='false' />"); + el.serverValidated = true; + result = $("<result valid='false' />")[0]; } } }); @@ -710,7 +719,11 @@ */ MMBaseValidator.prototype.validResult = function(xml) { try { - return "true" == "" + this.find(xml, 'result')[0].getAttribute("valid"); + if (xml.documentElement) { + return "true" == xml.documentElement.getAttribute("valid"); + } else { + return "true" == "" + $(xml).attr("valid"); + } } catch (ex) { this.log(ex); throw ex; _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs