diff --git a/hypha/apply/funds/templates/funds/application_base.html b/hypha/apply/funds/templates/funds/application_base.html index 3ce58cc98d..f5c9c6c73f 100644 --- a/hypha/apply/funds/templates/funds/application_base.html +++ b/hypha/apply/funds/templates/funds/application_base.html @@ -13,7 +13,9 @@ {% trans "Next deadline" %}: {{ page.end_date }}

{% endif %} +

{{ page.title }}

+ {% if form.errors or form.non_field_errors %}
{% heroicon_solid "exclamation-triangle" aria_hidden="true" class="inline me-2 fill-red-500" %} @@ -24,18 +26,30 @@

{{ page.title }}

{% endfor %} {% else %} -
{% trans "There were some errors with your form. Please amend the fields highlighted below" %}
+
+ {% trans "There were some errors with your form. Please amend the fields highlighted below" %} +
{% endif %}
{% endif %} {% if not page.open_round and not page.start_date and not request.is_preview %} - {# the page has no open rounds and we arent on a round page #} + {# the page has no open rounds and we arent on a round page #} {% verbose_name page as name %} -

{% blocktrans %}Sorry, this {{ name }} is not currently accepting applications.{% endblocktrans %} {% trans "See other funds" %} {% heroicon_mini "arrow-right" class="inline mb-0.5 align-text-bottom" %}

+

+ {% blocktrans %}Sorry, this {{ name }} is not currently accepting applications.{% endblocktrans %} + + {% trans "See other funds" %} {% heroicon_mini "arrow-right" class="inline mb-0.5 align-text-bottom" %} + +

{% else%} {% if page.get_parent.specific.guide_link %} - + {% trans "Application guide" %} {% endif %} @@ -67,15 +81,50 @@

{% blocktrans %}Sorry, this {{ name }} is not currently accepting applicatio {% endfor %}
- {# If a preview is required for this application, don't allow submitting yet (via name="preview"). At the moment, this functionality only works if a user is logged in. #} + {% comment %} + If a preview is required for this application, + don't allow submitting yet (via name="preview"). + At the moment, this functionality only works if a user is logged in. + {% endcomment %} {% if require_preview and request.user.is_authenticated %} - + {% else %} - + {% endif %} - + + + {% if not require_preview and request.user.is_authenticated %} - + {% endif %}
diff --git a/hypha/static_src/javascript/application-form.js b/hypha/static_src/javascript/application-form.js index 50f1d0e8ac..b3c5eca49f 100644 --- a/hypha/static_src/javascript/application-form.js +++ b/hypha/static_src/javascript/application-form.js @@ -1,7 +1,7 @@ (function () { const form = document.querySelector(".application-form"); const links = form.querySelectorAll("a"); - const button = form.querySelector("[type=submit]"); + const submitButtons = form.querySelectorAll("[type=submit]"); const required = form.querySelectorAll("input[required]"); const groups = form.querySelectorAll(".form__group"); const errors = form.querySelectorAll(".form__error"); @@ -51,12 +51,24 @@ // Block multiple form submits. form.addEventListener("submit", function () { - button.setAttribute("disabled", "disabled"); + // 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..."; + } + }); + }, 0); }); const unlockApplicationForm = function () { form.setAttribute("action", ""); - button.removeAttribute("disabled"); + submitButtons.forEach(function (button) { + button.removeAttribute("disabled"); + }); }; // Unlock form on @@ -65,9 +77,11 @@ // 3. tab or enter key pressed document.body.addEventListener("mousemove", unlockApplicationForm, { once: true, + passive: true, }); document.body.addEventListener("touchmove", unlockApplicationForm, { once: true, + passive: true, }); document.body.addEventListener( "keydown", @@ -76,6 +90,6 @@ unlockApplicationForm(); } }, - { once: true } + { once: true, passive: true } ); })();