onValidationError

fires when newly loaded/added/edited data fail to pass validation

void onValidationError(number|string id,object obj,object details);
id
number|stringthe ID of the data item that is being validated obj
objectthe data item object details
objectthe validation result for data keys under validation

Example

webix.ui({
    view:"datatable",
    rules:{
        title:webix.rules.isNotEmpty,
        rating:webix.rules.isNumber
    },
    on:{
        onValidationError:function(id, obj, details){
            var index = this.getIndexById(id)+1;
            webix.message({ type:"error", text:"Empty title for row "+index });
        }
     }
});

Related samples

Details

The above pattern of validation goes for collections (used for validating data in DataTable, List, DataView, etc.)

Since forms are validated differently, the event has different parametes, namely:

on:{
    onValidationError:function(key, obj){
      var text;
 
      if (key == "login")
        text = "Login can't be empty";
      if (key == "email")
        text = "Invalid Email";
 
      webix.message({ type:"error", text:text });
    }
}

Related sample:  onValidationError' Event

See also
  • API
  • Articles
  • Back to top
    Join Our Forum
    We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.