diff --git a/public/js/image_selector.js b/public/js/image_selector.js index a07aedbb..4bc4d6c1 100644 --- a/public/js/image_selector.js +++ b/public/js/image_selector.js @@ -11,6 +11,7 @@ function ImageSelector(form, maxFileSize, container, { this.resetLink = container.querySelector(".imginput-reset-link"); this.removeLink = container.querySelector(".imginput-remove-link"); this.filenameText = container.querySelector(".imginput-filename"); + this.errorEl = container.querySelector(".error"); this.originalImageUrl = this.imageEl.getAttribute("data-imginput-original"); this.originalImageFilename = this.imageEl.getAttribute("data-imginput-original-filename"); this.currentImageUrl = this.originalImageUrl; @@ -79,6 +80,8 @@ ImageSelector.prototype.updateSizeLimit = function(size) { }; ImageSelector.prototype.setError = function(error) { + this.errorEl.textContent = error; + this.errorEl.hidden = !error; this.fileInput.setCustomValidity(error); this.fileInput.reportValidity(); } diff --git a/src/templates/src/include/image_selector.html b/src/templates/src/include/image_selector.html index 84bbd2a4..884891be 100644 --- a/src/templates/src/include/image_selector.html +++ b/src/templates/src/include/image_selector.html @@ -1,7 +1,7 @@ {{/* NOTE(asaf): Make sure to include js/image_selector.js */}} - +