XWiki bundles the LiveValidation library. You can read its examples or the full documentation on their website. You may also be interested by the LiveValidation Macros extensions.

Exemple of use in XWiki

{{velocity output=false}}
$xwiki.jsfx.use('uicomponents/widgets/validation/livevalidation_prototype.js')
$xwiki.ssfx.use('uicomponents/widgets/validation/livevalidation.css')
{{/velocity}}
{{html}}
<form>
<div>
  <input type="text" name="fruits" class="mandatory">  
</div>
</form>
<script type="text/javascript">
// <![CDATA[
document.observe("dom:loaded", function(){
  var mandatoryInputs = $('mainContentArea').select('input.mandatory');
  for (var i=0;i&lt;mandatoryInputs.length;i++) {
    var input = mandatoryInputs[i];
    var valid = new LiveValidation( input, { validMessage: "OK!", wait: 500 } );
    valid.add( Validate.Presence,
              { failureMessage: "Mandatory" } );
   }
});
// ]]>
});
</script>
{{/html}}
Tags:
Created by Vincent Massol on 2017/09/05
   

Get Connected