Skip to content

Commit

Permalink
trigger validity check in media format validation
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Nov 28, 2024
1 parent af3fd08 commit 0496c8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

self._alert = alert;
self._$pathfield.after(self._alert);
self._checkValidity();
}

/**
Expand All @@ -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();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 0496c8c

Please sign in to comment.