Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hypha/apply/funds/templates/funds/application_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ <h4>
<button
class="w-full sm:w-auto btn btn-primary"
type="submit"
name="submit"
disabled
>
{% trans "Submit for review" %}
Expand Down
14 changes: 10 additions & 4 deletions hypha/static_src/javascript/application-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,23 @@
}

// Block multiple form submits.
let clickedButton = null;
submitButtons.forEach(function (button) {
button.addEventListener("click", function () {
clickedButton = button;
});
});

form.addEventListener("submit", function () {
// Use setTimeout with 0 delay to ensure form submission begins
// before the buttons are disabled, allowing their values to be included
setTimeout(function () {
submitButtons.forEach(function (button) {
button.setAttribute("disabled", "disabled");
if (button.textContent) {
button.dataset.originalText = button.textContent;
button.textContent = "Submitting...";
}
});
if (clickedButton && clickedButton.textContent) {
clickedButton.textContent = clickedButton.textContent.trim() + "…";
}
}, 0);
});

Expand Down
Loading