Wiki source code of LiveValidation UI Component

Version 1.1 by Jerome on 2010/03/18

Show last authors
1 XWiki bundles the LiveValidation library. You can read its [[examples>>documentation>>http://livevalidation.com/examples]] or the [[full documentation>>http://livevalidation.com/documentation]] on their website.
2
3 == Exemple 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 </script>
29 {{/html}}
30 {{/code}}

Get Connected