mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
oninvalid event is added to common drag and drop component
This commit is contained in:
parent
40bab7f3b2
commit
966803d3a3
@ -232,7 +232,7 @@
|
|||||||
th:name="${name}+'-input'" th:id="${name}+'-input-container'" th:data-text="#{fileChooser.hoveredDragAndDrop}">
|
th:name="${name}+'-input'" th:id="${name}+'-input-container'" th:data-text="#{fileChooser.hoveredDragAndDrop}">
|
||||||
<label class="file-input-btn d-none">
|
<label class="file-input-btn d-none">
|
||||||
<input type="file" class="form-control" th:name="${name}" th:id="${name}+'-input'" th:accept="${accept} + ',.zip'"
|
<input type="file" class="form-control" th:name="${name}" th:id="${name}+'-input'" th:accept="${accept} + ',.zip'"
|
||||||
th:attr="multiple=${!disableMultipleFiles}" th:required="${notRequired} ? null : 'required'">
|
th:attr="multiple=${!disableMultipleFiles}" th:required="${notRequired} ? null : 'required'" oninvalid="alert('Please select a PDF file before submitting.');">
|
||||||
Browse
|
Browse
|
||||||
</label>
|
</label>
|
||||||
<div class="d-flex justify-content-start align-items-center" id="fileInputText">
|
<div class="d-flex justify-content-start align-items-center" id="fileInputText">
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<span class="tool-header-text" th:text="#{AddStampRequest.header}"></span>
|
<span class="tool-header-text" th:text="#{AddStampRequest.header}"></span>
|
||||||
</div>
|
</div>
|
||||||
<form id="stampFormGroup" method="post" enctype="multipart/form-data" th:action="@{'/api/v1/misc/add-stamp'}">
|
<form id="stampFormGroup" method="post" enctype="multipart/form-data" th:action="@{'/api/v1/misc/add-stamp'}">
|
||||||
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf', notRequired=true)}"></div>
|
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div>
|
||||||
<br>
|
<br>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="pageOrder" th:text="#{pageSelectionPrompt}"></label>
|
<label for="pageOrder" th:text="#{pageSelectionPrompt}"></label>
|
||||||
@ -194,22 +194,6 @@
|
|||||||
alphabetGroup.style.display = 'none';
|
alphabetGroup.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
const form = document.getElementById('stampFormGroup');
|
|
||||||
if (form) {
|
|
||||||
form.addEventListener('submit', function(event) {
|
|
||||||
const fileInput = document.getElementById('fileInput-input');
|
|
||||||
if (!fileInput || fileInput.files.length === 0) {
|
|
||||||
// Prevent the form from submitting
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
alert('Please select a PDF file before submitting.');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
|
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
|
||||||
|
Loading…
Reference in New Issue
Block a user