### Eclipse Workspace Patch 1.0
#P xwiki-skin-colibri
Index: src/main/resources/colibri/edit.vm
===================================================================
--- src/main/resources/colibri/edit.vm (revision 29626)
+++ src/main/resources/colibri/edit.vm (working copy)
@@ -77,7 +77,7 @@
#set($docTitle = $!tdoc.title)
#end
+
#end
#template("editmodes.vm")
#template("edit${editor}.vm")
#P xwiki-web-standard
Index: src/main/webapp/resources/js/xwiki/xwiki.js
===================================================================
--- src/main/webapp/resources/js/xwiki/xwiki.js (revision 29626)
+++ src/main/webapp/resources/js/xwiki/xwiki.js (working copy)
@@ -461,6 +461,27 @@
}
}
},
+
+ /**
+ * Enable live validation for inputs with classname 'required'.
+ */
+ initRequiredInputsValidation: function(content) {
+ // apply this transformation only in the inline and edit modes
+ if (XWiki.contextaction == "edit" || XWiki.contextaction == "inline") {
+ if (typeof content == "undefined") {
+ content = document.body;
+ }
+ var inputs = content.select("input.required");
+ for (var i = 0; i < inputs.length; i++) {
+ var input = inputs[i];
+ var validator = new LiveValidation(input, { validMessage: "" });
+ validator.add(Validate.Presence, {
+ failureMessage: "$msg.get('core.editors.validation.mandatoryField')"
+ });
+ validator.validate();
+ }
+ }
+ },
/**
* Watchlist methods.
@@ -592,6 +613,7 @@
this.fixLinksTargetAttribute();
this.insertSectionEditLinks();
this.insertCreatePageFromTemplateModalBoxes();
+ this.initRequiredInputsValidation();
this.watchlist.initialize();
document.fire("xwiki:dom:loaded");
Index: src/main/webapp/templates/javascript.vm
===================================================================
--- src/main/webapp/templates/javascript.vm (revision 29626)
+++ src/main/webapp/templates/javascript.vm (working copy)
@@ -46,6 +46,8 @@
// ]]>
#if(($context.action=="inline")||($context.action=="edit") || ($context.action=="admin"))
+$xwiki.get('jsfx').use('uicomponents/widgets/validation/livevalidation_prototype.js')
+$xwiki.get('ssfx').use('uicomponents/widgets/validation/livevalidation.css')