Update of /var/cvs/html/mmbase/validation
In directory james.mmbase.org:/tmp/cvs-serv11384
Modified Files:
Tag: MMBase-1_8
datatype.jspx test.jspx validation.js.jsp
Log Message:
gave some problems with anonymous datatypes. Fixed for now.
See also: http://cvs.mmbase.org/viewcvs/html/mmbase/validation
Index: datatype.jspx
===================================================================
RCS file: /var/cvs/html/mmbase/validation/datatype.jspx,v
retrieving revision 1.4.2.6
retrieving revision 1.4.2.7
diff -u -b -r1.4.2.6 -r1.4.2.7
--- datatype.jspx 28 Mar 2008 15:45:48 -0000 1.4.2.6
+++ datatype.jspx 11 Nov 2008 16:06:36 -0000 1.4.2.7
@@ -12,7 +12,7 @@
@todo: This JSP must accept a 'language' attribute, and all restriction
error message must be included.
That way, also those can be used in javascript.
- $Id: datatype.jspx,v 1.4.2.6 2008/03/28 15:45:48 michiel Exp $
+ $Id: datatype.jspx,v 1.4.2.7 2008/11/11 16:06:36 michiel Exp $
author: Michiel Meeuwissen
-->
<jsp:output omit-xml-declaration="true" />
@@ -20,7 +20,7 @@
<jsp:scriptlet>
if (dataType == null) {
- response.setStatus(404);
+ //response.setStatus(404);
</jsp:scriptlet>
<notfound />
<jsp:scriptlet>
Index: test.jspx
===================================================================
RCS file: /var/cvs/html/mmbase/validation/test.jspx,v
retrieving revision 1.6.2.4
retrieving revision 1.6.2.5
diff -u -b -r1.6.2.4 -r1.6.2.5
--- test.jspx 26 Nov 2007 16:57:05 -0000 1.6.2.4
+++ test.jspx 11 Nov 2008 16:06:36 -0000 1.6.2.5
@@ -33,7 +33,7 @@
<mm:import externid="field" />
<mm:notpresent referid="field">
- <mm:import externid="datatype">requiredfield</mm:import>
+ <mm:import externid="datatype"
vartype="string">requiredfield</mm:import>
</mm:notpresent>
<mm:present referid="field">
<mm:import externid="nodemanager" required="true" />
Index: validation.js.jsp
===================================================================
RCS file: /var/cvs/html/mmbase/validation/validation.js.jsp,v
retrieving revision 1.11.2.28
retrieving revision 1.11.2.29
diff -u -b -r1.11.2.28 -r1.11.2.29
--- validation.js.jsp 18 Apr 2008 08:58:09 -0000 1.11.2.28
+++ validation.js.jsp 11 Nov 2008 16:06:36 -0000 1.11.2.29
@@ -9,7 +9,7 @@
* then call validator.setup(el).
*
* @author Michiel Meeuwissen
- * @version $Id: validation.js.jsp,v 1.11.2.28 2008/04/18 08:58:09 michiel Exp
$
+ * @version $Id: validation.js.jsp,v 1.11.2.29 2008/11/11 16:06:36 michiel Exp
$
*/
@@ -92,9 +92,11 @@
errorTextArea.value = "LOG: " + msg + "\n" + errorTextArea.value;
} else {
// firebug console
+ if (typeof(console) != "undefined") {
console.log(msg);
}
}
+ }
}
MMBaseValidator.prototype.trace = function (msg) {
@@ -104,9 +106,11 @@
errorTextArea.value = "TRACE: " + msg + "\n" + errorTextArea.value;
} else {
// firebug console
+ if (typeof(console) != "undefined") {
console.log(msg);
}
}
+ }
}
/**
@@ -176,8 +180,8 @@
MMBaseValidator.prototype.isRequired = function(el) {
if (el.mm_isrequired != null) return el.mm_isrequired;
var re = this.find(this.getDataTypeXml(el), 'datatype required')[0];
- el.mm_isrequired = "true" == "" + re.getAttribute("value");
- el.mm_isrequired_enforce = re.getAttribute("enforce");
+ el.mm_isrequired = re != null && ("true" == "" + re.getAttribute("value"));
+ el.mm_isrequired_enforce = re != null && re.getAttribute("enforce");
return el.mm_isrequired;
}
@@ -272,6 +276,7 @@
var pattern = new RegExp(javaClass);
var xml = this.getDataTypeXml(el);
var javaClassElement = this.find(xml, 'datatype class')[0];
+ if (! javaClassElement) return false;
var name = javaClassElement.getAttribute("name");
if (pattern.test(name)) {
return true;
@@ -323,6 +328,12 @@
return el.isbinary;
}
+MMBaseValidator.prototype.isXml = function(el) {
+ if (el.mm_isxml != null) return el.mm_isxml;
+ el.mm_isxml= this.hasJavaClass(el, "org\.mmbase\.datatypes\.XmlDataType");
+ return el.mm_isxml;
+}
+
MMBaseValidator.prototype.INTEGER = /^[+-]?\d+$/;
MMBaseValidator.prototype.FLOAT =
/^[+-]?(\d+|\d+\.\d*|\d*\.\d+)(e[+-]?\d+|)$/i;
@@ -445,7 +456,8 @@
var url = '<mm:url page="/mmbase/validation/datatype.jspx" />';
var params = this.getDataTypeArguments(key);
var self = this;
- $.ajax({async: false, url: url, type: "GET", dataType: "xml", data:
params,
+ $.ajax({async: false, url: url, type: "GET",
+ dataType: "xml", data: params,
complete: function(res, status){
if (status == "success") {
dataType = res.responseXML;
@@ -847,6 +859,7 @@
case "select-multiple":
default:
this.log("Adding eventhandler to " + entry);
+ this.log(entry);
$(entry).bind("change", function(ev) { self.validate(ev); });
$(entry).bind("blur", function(ev) { self.serverValidate(ev); });
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs