Show last authors
1 XWiki bundles the LiveValidation library. You can read its [[examples>>https://web.archive.org/web/20150317065621/http://livevalidation.com/examples]] or the [[full documentation>>https://web.archive.org/web/20150315055649/http://livevalidation.com/documentation]] on their website. You may also be interested by the [[LiveValidation Macros>>extensions:Extension.LiveValidation Macros]] extensions.
2
3 = Example of use in XWiki =
4
5 {{code}}
6 {{velocity output=false}}
7 $xwiki.jsfx.use('uicomponents/widgets/validation/livevalidation_prototype.js')
8 $xwiki.ssfx.use('uicomponents/widgets/validation/livevalidation.css')
9 {{/velocity}}
10 {{html}}
11 <form>
12 <div>
13 <input type="text" name="fruits" class="mandatory">
14 </div>
15 </form>
16 <script type="text/javascript">
17 // <![CDATA[
18 document.observe("dom:loaded", function(){
19 var mandatoryInputs = $('mainContentArea').select('input.mandatory');
20 for (var i=0;i&lt;mandatoryInputs.length;i++) {
21 var input = mandatoryInputs[i];
22 var valid = new LiveValidation( input, { validMessage: "OK!", wait: 500 } );
23 valid.add( Validate.Presence,
24 { failureMessage: "Mandatory" } );
25 }
26 });
27 // ]]>
28 });
29 </script>
30 {{/html}}
31 {{/code}}

Get Connected