ValidationReason

  • Updated

Represents a specific reason for a field invalidation.

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++){ for(var j=0; j < validations[i].activeReasons.length; j++){
var validationReason = validations[i].activeReasons[j];
console.log(validationReason.target); } } });

 

isActive Returns: bool

Description:

Boolean indicating whether or not this Validation 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++){
      for(var j=0; j < validations[i].activeReasons.length; j++){ 
         var validationReason = validations[i].activeReasons[j];
         console.log(validationReason.isActive);
      }
   }
});
			

 

firedByElementId Returns: string

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];
console.log(validationReason.firedByElementId); } } });

 

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++){ for(var j=0; j < validations[i].activeReasons.length; j++){
var validationReason = validations[i].activeReasons[j];
console.log(validationReason.message); } } });

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.