From a94e76d45f483110965b05135f96e5881269ce8b Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 14 Aug 2018 15:01:01 +0100 Subject: [PATCH] exclude validators in readonly mode forms --- .../form/components/widgets/core/form-field.model.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/core/form/components/widgets/core/form-field.model.ts b/lib/core/form/components/widgets/core/form-field.model.ts index 07cdf72030..3c33d30ca3 100644 --- a/lib/core/form/components/widgets/core/form-field.model.ts +++ b/lib/core/form/components/widgets/core/form-field.model.ts @@ -120,11 +120,13 @@ export class FormFieldModel extends FormWidgetModel { validate(): boolean { this.validationSummary = new ErrorMessageModel(); - let validators = this.form.fieldValidators || []; - for (let validator of validators) { - if (!validator.validate(this)) { - this._isValid = false; - return this._isValid; + if (!this.readOnly) { + let validators = this.form.fieldValidators || []; + for (let validator of validators) { + if (!validator.validate(this)) { + this._isValid = false; + return this._isValid; + } } }