Validation

  • Updated

Represents a validation fired by the runtime engine from a Mark Field Invalid action.

target Returns: string

Description:

Returns the element id of the target of this Validation

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){ var validations = session.getActiveValidations();
for(var i=0;i < validations.length; i++){ console.log(validations[i].target); } });

 

isActive Returns: bool

Description:

Boolean that identifies whether or not this Validation instance is active

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){ var validations = session.getActiveValidations();
for(var i=0;i < validations.length; i++){ console.log(validations[i].isActive); } });

 

activeReasons Returns: Array of ValidationReason

Description:

Array of ValidationReason

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){ var validations = session.getActiveValidations();
for(var i=0;i < validations.length; i++){ for(var j=0; j < validations[i].activeReasons.length; j++){
var validationReason = validations[i].activeReasons[j]; // Do something with the validationReason } } });

 

message Returns: string

Description:

Returns the validation message from this Validation

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){ var validations = session.getActiveValidations();
for(var i=0;i < validations.length; i++){ console.log(validations[i].message); } });

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.