From 51453c04d041e1ed3a9b06f0929790ee0b80b08f Mon Sep 17 00:00:00 2001 From: David Tsay Date: Mon, 31 Mar 2025 13:53:16 -0700 Subject: [PATCH] fix logical reporting overriding previous logical validation --- src/plugins/timeConductor/TimePopupFixed.vue | 24 ++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/plugins/timeConductor/TimePopupFixed.vue b/src/plugins/timeConductor/TimePopupFixed.vue index 800a57d29c..a3980bd22a 100644 --- a/src/plugins/timeConductor/TimePopupFixed.vue +++ b/src/plugins/timeConductor/TimePopupFixed.vue @@ -178,9 +178,7 @@ export default { handleFormSubmission(shouldDismiss) { this.validateLimit(); this.validateBounds(); - this.reportValidity('bounds'); - // report on this custom validity check last after more basic checks - this.reportValidity('limit'); + this.reportLogicalValidity(); if (this.isValid) { this.setBoundsFromView(shouldDismiss); @@ -224,7 +222,7 @@ export default { }, reportValidity(refName) { const input = this.getInput(refName); - const validationResult = this.inputValidityMap[refName] ?? this.logicalValidityMap[refName]; + const validationResult = this.inputValidityMap[refName]; if (validationResult.valid !== true) { input.setCustomValidity(validationResult.message); @@ -236,6 +234,24 @@ export default { this.$refs.fixedDeltaInput.reportValidity(); }, + reportLogicalValidity() { + const input = this.getInput(); + const boundsValidationResult = this.logicalValidityMap.bounds; + const limitValidationResult = this.logicalValidityMap.limit; + + if (boundsValidationResult.valid !== true) { + input.setCustomValidity(boundsValidationResult.message); + input.title = boundsValidationResult.message; + } else if (limitValidationResult.valid !== true) { + input.setCustomValidity(limitValidationResult.message); + input.title = limitValidationResult.message; + } else { + input.setCustomValidity(''); + input.title = ''; + } + + this.$refs.fixedDeltaInput.reportValidity(); + }, getInput(refName) { if (Object.keys(this.inputValidityMap).includes(refName)) { return this.$refs[refName];