diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index 41e1ca0de..145129dc2 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -207,13 +207,24 @@ BI.Input = BI.inherit(BI.Single, { }, _checkValidationOnValueChange: function () { - var o = this.options; + var self = this, o = this.options; var v = this.getValue(); - this.setValid( - (o.allowBlank === true && BI.trim(v) == "") || ( - BI.isNotEmptyString(BI.trim(v)) && o.validationChecker.apply(this, [BI.trim(v)]) !== false - ) - ); + if (o.allowBlank === true && BI.trim(v) == "") { + this.setValid(true); + return; + } + if (BI.trim(v) == "") { + this.setValid(false); + return; + } + var checker = o.validationChecker.apply(this, [BI.trim(v)]); + if (checker instanceof Promise) { + checker.then(function (validate) { + self.setValid(validate !== false); + }) + } else { + this.setValid(checker !== false); + } }, focus: function () {