diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index 1c02cac0c..ea3f0e8d1 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -83,6 +83,7 @@ loading=Loading... addToDoc=Add to Document reset=Reset apply=Apply +noFileSelected=No file selected. Please upload one. legal.privacy=Privacy Policy legal.terms=Terms and Conditions @@ -1308,7 +1309,7 @@ survey.button=Take Survey survey.dontShowAgain=Don't show again survey.meeting.1=If you're using Stirling PDF at work, we'd love to speak to you. We're offering technical support sessions in exchange for a 15 minute user discovery session. survey.meeting.2=This is a chance to: -survey.meeting.3=Get help with deployment, integrations, or troubleshooting +survey.meeting.3=Get help with deployment, integrations, or troubleshooting survey.meeting.4=Provide direct feedback on performance, edge cases, and feature gaps survey.meeting.5=Help us refine Stirling PDF for real-world enterprise use survey.meeting.6=If you're interested, you can book time with our team directly. (English speaking only) diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties index 0c35d6c55..e56767c41 100644 --- a/src/main/resources/messages_en_US.properties +++ b/src/main/resources/messages_en_US.properties @@ -83,6 +83,7 @@ loading=Loading... addToDoc=Add to Document reset=Reset apply=Apply +noFileSelected=No file selected. Please upload one. legal.privacy=Privacy Policy legal.terms=Terms and Conditions diff --git a/src/main/resources/static/js/fileInput.js b/src/main/resources/static/js/fileInput.js index 7e89e6cc3..28331ef01 100644 --- a/src/main/resources/static/js/fileInput.js +++ b/src/main/resources/static/js/fileInput.js @@ -35,6 +35,7 @@ function setupFileInput(chooser) { const pdfPrompt = chooser.getAttribute('data-bs-pdf-prompt'); const inputContainerId = chooser.getAttribute('data-bs-element-container-id'); const showUploads = chooser.getAttribute('data-bs-show-uploads') === "true"; + const noFileSelectedPrompt = chooser.getAttribute('data-bs-no-file-selected'); let inputContainer = document.getElementById(inputContainerId); const input = document.getElementById(elementId); @@ -58,6 +59,12 @@ function setupFileInput(chooser) { inputBtn.click(); }); + // Handle form validation if the input is left empty + input.addEventListener("invalid", (e) => { + e.preventDefault(); + alert(noFileSelectedPrompt); + }); + const dragenterListener = function () { dragCounter++; if (!overlay) { diff --git a/src/main/resources/templates/fragments/common.html b/src/main/resources/templates/fragments/common.html index 66fa94b58..a407f60ee 100644 --- a/src/main/resources/templates/fragments/common.html +++ b/src/main/resources/templates/fragments/common.html @@ -228,7 +228,7 @@ loading: '[[#{loading}]]' };