From 0496c8c7b7da5818986803fbf1c66cf35e33b790 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Thu, 28 Nov 2024 10:15:56 +0100 Subject: [PATCH] trigger validity check in media format validation --- .../authoring/dialog/js/mediaFormatValidate.js | 11 +++++++++++ .../clientlibs/authoring/dialog/js/validation.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app-root/clientlibs/authoring/dialog/js/mediaFormatValidate.js b/src/main/webapp/app-root/clientlibs/authoring/dialog/js/mediaFormatValidate.js index 5ef402e9..475d6123 100644 --- a/src/main/webapp/app-root/clientlibs/authoring/dialog/js/mediaFormatValidate.js +++ b/src/main/webapp/app-root/clientlibs/authoring/dialog/js/mediaFormatValidate.js @@ -80,6 +80,7 @@ self._alert = alert; self._$pathfield.after(self._alert); + self._checkValidity(); } /** @@ -91,6 +92,16 @@ $(self._alert).remove(); delete self._alert; } + self._checkValidity(); + } + + /** + * Check validity of form control. + */ + MediaFormatValidate.prototype._checkValidity = function () { + var self = this; + var validation = self._$pathfield.adaptTo("foundation-validation"); + validation.checkValidity(); } /** diff --git a/src/main/webapp/app-root/clientlibs/authoring/dialog/js/validation.js b/src/main/webapp/app-root/clientlibs/authoring/dialog/js/validation.js index dff3e74d..30457ef3 100644 --- a/src/main/webapp/app-root/clientlibs/authoring/dialog/js/validation.js +++ b/src/main/webapp/app-root/clientlibs/authoring/dialog/js/validation.js @@ -57,7 +57,7 @@ selector: '[data-foundation-validation="wcmio.handler.media.mediaFormat"]', validate: function(el) { var nextSibling = el.nextSibling; - if (nextSibling && nextSibling.tagName.toLowerCase() === 'coral-alert') { + if (nextSibling?.tagName?.toLowerCase() === 'coral-alert') { return nextSibling.textContent; } }