Wiki source code of LiveValidation UI Component

Version 3.1 by Denis Gervalle on 2015/12/11

Hide last authors
Denis Gervalle 3.1 1 XWiki bundles the LiveValidation library. You can read its [[examples>>http://livevalidation.com/examples]] or the [[full documentation>>http://livevalidation.com/documentation]] on their website. You may also be interested by the [[LiveValidation Macros>>extensions:Extension.LiveValidation Macros]] extensions.
Jerome 1.1 2
Manuel Smeria 2.3 3 = Exemple of use in XWiki =
Jerome 1.1 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 }
Jerome 2.2 26 });
Jerome 1.1 27 // ]]>
28 });
29 </script>
30 {{/html}}
31 {{/code}}

Get Connected