jvelociter (SVN) wrote:
Author: jvelociter
Date: 2008-07-22 17:57:57 +0200 (Tue, 22 Jul 2008)
New Revision: 11418
Modified:
xwiki-products/xwiki-workspaces/trunk/wiki/src/main/resources/XWSCode/CreateNewWorkspaceForm
Log:
XWS-127 Client side validation on workspace creation form does not work under IE6
Modified:
xwiki-products/xwiki-workspaces/trunk/wiki/src/main/resources/XWSCode/CreateNewWorkspaceForm
===================================================================
---
xwiki-products/xwiki-workspaces/trunk/wiki/src/main/resources/XWSCode/CreateNewWorkspaceForm 2008-07-22
15:50:14 UTC (rev 11417)
+++
xwiki-products/xwiki-workspaces/trunk/wiki/src/main/resources/XWSCode/CreateNewWorkspaceForm 2008-07-22
15:57:57 UTC (rev 11418)
@@ -12,9 +12,9 @@
<customClass></customClass>
<contentAuthor>XWiki.Admin</contentAuthor>
<creationDate>1208697558000</creationDate>
-<date>1214058248000</date>
-<contentUpdateDate>1214058248000</contentUpdateDate>
-<version>3.1</version>
+<date>1216745595000</date>
+<contentUpdateDate>1216745595000</contentUpdateDate>
+<version>5.1</version>
<title></title>
<template></template>
<defaultTemplate></defaultTemplate>
@@ -140,7 +140,29 @@
// inform how much chars can be still typed
$('spacetitlecharsleft').innerHTML = maxTitleChars -
dTitle.value.length;
}
- }</code>
+ }
+
+/*
+ * getElementsByClassName rewrite.
+ * Developed by Robert Nyman,
http://www.robertnyman.com
+ * Code/licensing:
http://code.google.com/p/getelementsbyclassname/
+ */
+function getElementsByClassName(className, tag, elm){
+ var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
+ var tag = tag || "*";
+ var elm = elm || document;
+ var elements = (tag == "*" && elm.all)? elm.all :
elm.getElementsByTagName(tag);
+ var returnElements = [];
+ var current;
+ var length = elements.length;
+ for(var i=0; i<length; i++){
+ current = elements[i];
+ if(testClass.test(current.className)){
+ returnElements.push(current);
+ }
+ }
+ return returnElements;
+}</code>
getElementsByClassName also exists in prototype. We should use that one
instead.
</property>
<property>
<name>Create new workspace validation</name>
@@ -235,8 +257,8 @@
var sDesc = $('XWiki.SpaceClass_0_description');
var wAccess = $('XWiki.WorkspaceSpaceClass_0_accesslevel');
var wColor = $('XWiki.WorkspaceSpaceClass_0_color');
- var colorPreview =
wColor.parentNode.parentNode.getElementsByClassName("form-entry-valid")[0];
- var
vSpan=dTitle.parentNode.parentNode.getElementsByClassName("form-entry-valid")[0];
+ var colorPreview =
getElementsByClassName("form-entry-valid","*",wColor.parentNode.parentNode)[0];
+ var vSpan =
getElementsByClassName("form-entry-valid","*",dTitle.parentNode.parentNode)[0];
Event.observe(dTitle,"keyup", titleKeyTyped());
Event.observe(dTitle,"blur", validateTitle());
// Green the optional/already filled fields on blur...
--
Sergiu Dumitriu
http://purl.org/net/sergiu/