From e2821bc67641c6d9663b43f4ed8df700cd09a83c Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Fri, 10 Aug 2018 14:03:18 -0400 Subject: [PATCH] add a modified var, to allow fields to re-validate when there are existing errors --- js/components/text_input.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/components/text_input.js b/js/components/text_input.js index 06eb100c..60e9021f 100644 --- a/js/components/text_input.js +++ b/js/components/text_input.js @@ -29,7 +29,8 @@ export default { pipe: inputValidations[this.validation].pipe || undefined, keepCharPositions: inputValidations[this.validation].keepCharPositions || false, validationError: inputValidations[this.validation].validationError || '', - value: this.initialValue + value: this.initialValue, + modified: false } }, @@ -60,6 +61,7 @@ export default { // When we use the masked-input component, we receive the value directly const value = typeof e === 'object' ? e.target.value : e this.value = value + this.modified = true this._checkIfValid({ value }) }, @@ -74,7 +76,7 @@ export default { // Validate the value let valid = this._validate(value) - if (this.initialErrors && this.initialErrors.length) { + if (!this.modified && this.initialErrors && this.initialErrors.length) { valid = false }