" + this.errors().map(function (e) {
return "" + e.error + ""
}).join("") + "";
};
this.performValidation = function () {
if (this.errors().length <= 0) {
this._onSucess();
} else {
this._onFailure();
}
}
this.displayErrorModal = function () {
//event.preventDefault();
OC_MODAL_UTILITY.errorMessageModal(this.errorHtml());
};
this._onSucess = validationFieldObject.onValidationSuccess || null;
this._onFailure = validationFieldObject.onValidationFailure || this.displayErrorModal;
// this.performValidation = new Promise() endRegion
};
var ValidationManager = function(obj){
this.validationEngines = [];
this.validationEnginesMap = {};
this._engineKeys = [];
this._buildEngines = function(){
for(var i = 0 ; i < obj.validators.length; i++){
var engine = new ValidationEngine(obj.validators[i]);
this.validationEngines.push(engine);
this.validationEnginesMap[engine.name] = obj.validators[i];
}
}
this.addEngine = function(engine){
};
this.removeEngine = function(){
}
this._testDupes = function(engine){
if(this._engineKeys.indexOf(engine.name) > -1){
throw "Cannot add validation engine with the same name as previously defined"
return false;
} else {
return true;
}
}
this._buildEngines();
};