From 461e83df28427efd7f4d2f68482cb628f3425ab9 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 12 Jan 2023 09:17:29 -0700 Subject: [PATCH] Remove all validation messages on focus, not just manual / server-side messages. Server side ones are still re-added on blur, client-side messages are re-run. --- api/js/etemplate/Et2InputWidget/Et2InputWidget.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts index 4b569de294..2d15d9ca5f 100644 --- a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts +++ b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts @@ -273,7 +273,8 @@ const Et2InputWidgetMixin = >(superclass : T) this.updateComplete.then(() => { - this.set_validation_error(false); + // Remove all messages. Manual will be explicitly replaced, other validators will be re-run on blur. + this.querySelectorAll("lion-validation-feedback").forEach(e => e.remove()); }); } @@ -290,11 +291,11 @@ const Et2InputWidgetMixin = >(superclass : T) { this.validators = this.validators.concat(this._messagesHeldWhileFocused); this._messagesHeldWhileFocused = []; - this.updateComplete.then(() => - { - this.validate(); - }); } + this.updateComplete.then(() => + { + this.validate(); + }); } set_value(new_value)