From 9f4663a8d5d164450fc249aa9c22d42177e0f791 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 18:06:24 -0400 Subject: [PATCH] Use initial errors as validation error until change is made This fixes a bug where the "Task Order not found" error was not shown. --- js/components/text_input.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/components/text_input.js b/js/components/text_input.js index 7d0bb78d..883e0a75 100644 --- a/js/components/text_input.js +++ b/js/components/text_input.js @@ -18,7 +18,10 @@ export default { type: String, default: () => '' }, - initialErrors: Array, + initialErrors: { + type: Array, + default: () => [] + }, paragraph: String, noMaxWidth: String }, @@ -30,7 +33,7 @@ export default { mask: inputValidations[this.validation].mask, pipe: inputValidations[this.validation].pipe || undefined, keepCharPositions: inputValidations[this.validation].keepCharPositions || false, - validationError: inputValidations[this.validation].validationError || '', + validationError: this.initialErrors.join(' ') || inputValidations[this.validation].validationError, value: this.initialValue, modified: false } @@ -82,6 +85,10 @@ export default { valid = false } + if (this.modified) { + this.validationError = inputValidations[this.validation].validationError + } + // Show error messages or not if (valid) { this.showError = false