View | Details | Raw Unified | Return to bug 41926
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js (-1 / +28 lines)
Lines 38-40 $("body").on("click", ".submit-form-link", function (e) { Link Here
38
    e.preventDefault();
38
    e.preventDefault();
39
    submit_form(this);
39
    submit_form(this);
40
});
40
});
41
- 
41
42
let forms_submitting = [];
43
$("body").on("submit", "form.submit-form-prevent-resubmit", function (e) {
44
    let should_we_send_it = true;
45
    forms_submitting.forEach(el => {
46
        if (el.is(this)) {
47
            should_we_send_it = false;
48
        }
49
    });
50
51
    if (!should_we_send_it) {
52
        e.preventDefault();
53
        return false;
54
    }
55
56
    forms_submitting.push($(this));
57
});
58
59
$("body").on("change", "form.submit-form-prevent-resubmit", function (e) {
60
    let form_el = $(this);
61
    // If user is able to change the form before the next page loads,
62
    // allow them to resubmit the form with the new values
63
    forms_submitting.forEach(function (item, index, object) {
64
        if ($(item).attr("id") === form_el.attr("id")) {
65
            object.splice(index, 1);
66
        }
67
    });
68
});

Return to bug 41926