Skip to content

Commit

Permalink
fix: don't show spinner if form validation failed
Browse files Browse the repository at this point in the history
  • Loading branch information
ViRb3 committed Feb 21, 2021
1 parent dcbaa64 commit 409ba4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/index.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="modal fade" id="uploadModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<form action="/app" method="post" enctype="multipart/form-data">
<form id="uploadForm" action="/app" method="post" enctype="multipart/form-data">
<div class="modal-header">
<h5 class="modal-title">Upload App</h5>
<button id="btnModalClose" type="button" class="btn-close" data-bs-dismiss="modal"></button>
Expand Down Expand Up @@ -121,6 +121,7 @@
const fileSelect = document.getElementById("fileSelect")
const fileElem = document.getElementById("fileElem");
const fileSubmit = document.getElementById("fileSubmit");
const uploadForm = document.getElementById("uploadForm");
const fileSpinner = document.getElementById("fileSpinner");
const modalElem = document.getElementById('uploadModal')
const modal = new bootstrap.Modal(modalElem, {
Expand All @@ -142,7 +143,7 @@
modal.show()
}
});
fileSubmit.addEventListener("click", function () {
uploadForm.addEventListener("submit", function () {
fileSubmit.classList.add("disabled")
btnModalClose.classList.add("disabled")
fileSpinner.style.display = "inline-block"
Expand Down

0 comments on commit 409ba4e

Please sign in to comment.