Wiki source code of Live Validation
Last modified by Anca Luca on 2023/10/20
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
8.1 | 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. |
![]() |
1.1 | 2 | |
![]() |
4.4 | 3 | = Example of use in XWiki = |
![]() |
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}} | ||
![]() |
6.2 | 10 | |
![]() |
1.1 | 11 | {{html}} |
![]() |
6.2 | 12 | <form method="get" action=""> |
13 | <p><input type="text" name="fruits" class="mandatory"/></p> | ||
14 | <p><button>Submit</button></p> | ||
![]() |
1.1 | 15 | </form> |
![]() |
6.2 | 16 | <script> |
17 | require(['jquery'], function ($) { | ||
18 | $(function () { | ||
19 | var mandatoryInputs = $('input.mandatory'); | ||
![]() |
9.1 | 20 | mandatoryInputs.each(function(i){ |
21 | var valid = new LiveValidation( this, { validMessage: "OK!", wait: 500 } ); | ||
22 | valid.add( Validate.Presence, { failureMessage: "Mandatory" } ); | ||
23 | }) | ||
![]() |
6.2 | 24 | }); |
25 | }); | ||
![]() |
1.1 | 26 | </script> |
27 | {{/html}} | ||
28 | {{/code}} |