]> git.ipfire.org Git - ipfire.org.git/commitdiff
donate: Disable all buttons after submit
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 23 Feb 2022 18:35:19 +0000 (18:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jun 2023 10:03:21 +0000 (10:03 +0000)
This helps to avoid any double-submissions of the form

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/donate/donate.html

index b1562d2835c893308cd04425f5facae583af0c3f..beea3a9ca2f0e295a50959822e40222b4a7caf77 100644 (file)
@@ -23,7 +23,7 @@
                <div class="container">
                        <div class="row justify-content-center">
                                <div class="col-12 col-md-8">
-                                       <form action="" method="POST">
+                                       <form id="donation-form" action="" method="POST">
                                                {% raw xsrf_form_html() %}
 
                                                <div class="row">
                        var frequency = $("input[name='frequency']");
                        var submit    = $("#donate");
                        var modal     = $("#modal-monthly-suggestions");
+                       var form      = $("#donation-form");
 
                        // Adjust form to default currency
                        if (currency.val() == "EUR") {
                                }
                        });
 
+                       // Disable all submit buttons after the form has been submitted
+                       form.one("submit", function() {
+                               submit.prop("disabled", true);
+                               $(".monthly-amount-suggestion").prop("disabled", true);
+                       });
+
                        $(".monthly-amount-suggestion").click(function (event) {
                                // Set frequency to monthly
                                $("input[name='frequency-selector']").prop("checked", false);