Documentation

onValidationError

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

void onValidationError(number| string id,object obj,object details){ ... };

Parameters

idnumber| stringid of the data item that is being validated
objobjectdata item object
detailsobjectvalidation 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 });
        }
     }
});

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 changes slightly and has different parametes, namely:

  • key (string) - data key that is being validated
  • obj (object) - data object
on:{
    onValidationError:function(key, value ){
        var index = this.getIndexById(id)+1;
        webix.message({ type:"error", text:"Empty title for row "+index });
    }
}

Related sample:  'onValidationError' Event

See also

Back to top