From a6a8d08101fa072ebc7fde3fe62278623ec68d50 Mon Sep 17 00:00:00 2001
From: Sandeep Chauhan <sandeepsajan0@gmail.com>
Date: Mon, 22 May 2023 12:41:06 +0530
Subject: [PATCH] Fix permission error on double click on submit determination
 (#3422)

Fixes #3342

This PR contains changes only for determination. We will be implementing
the same approach for other forms as well.
---
 .../templates/determinations/base_determination_form.html     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hypha/apply/determinations/templates/determinations/base_determination_form.html b/hypha/apply/determinations/templates/determinations/base_determination_form.html
index 4d17d56ca..28eb214c6 100644
--- a/hypha/apply/determinations/templates/determinations/base_determination_form.html
+++ b/hypha/apply/determinations/templates/determinations/base_determination_form.html
@@ -19,7 +19,7 @@
     {% block determination_information %}
     {% endblock %}
 
-    <form class="form form--with-p-tags" action="" method="post">
+    <form class="form form--with-p-tags" action="" method="post" x-data="{ isFormSubmitting: false }" x-on:submit="isFormSubmitting = true">
         {{ form.media }}
         {% csrf_token %}
 
@@ -47,7 +47,7 @@
             {% if form.draft_button_name %}
                 <button class="button button--submit button--top-space button--white" type="submit" name="{{ form.draft_button_name }}" formnovalidate>{% trans "Save draft" %}</button>
             {% endif %}
-            <button class="button button--submit button--top-space button--primary" type="submit" name="submit">{% trans "Submit" %}</button>
+            <button class="button button--submit button--top-space button--primary" :disabled="isFormSubmitting" type="submit" name="submit">{% trans "Submit" %}</button>
         {% endblock %}
     </form>
     {% for type, message in message_templates.items %}
-- 
GitLab