From 07d212c02413263696bcd7b3e3468d0879b26a74 Mon Sep 17 00:00:00 2001 From: Bo Gustavsson Date: Wed, 4 Sep 2024 21:49:47 +0200 Subject: [PATCH] Bug 37836: Prevent submitting empty barcodes in Self check-in This patch disbles the "Submit" button when the barcode field is empty. To test this patch: Add the patch to your koha clone Enable the "SelfCheckInModule". Open the page and the "Submit" button should be disabled when the barcode field is empty. Signed-off-by: Sam Sowanick Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer --- .../bootstrap/en/modules/sci/sci-main.tt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt index bc5d1affeb..d10c3fb0b0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt @@ -281,6 +281,33 @@ } } } + + + function checkBarcodeInput() { + var inputField = document.getElementById("barcode_input"); + var button = document.getElementById("sci_append_button"); + + if (inputField.value.trim() === "") { + button.disabled = true; + } else { + button.disabled = false; + } + } + +checkBarcodeInput(); + +document.getElementById("barcode_input").addEventListener("input", checkBarcodeInput); + +document.getElementById("sci_append_button").addEventListener("click", function() { + setTimeout(checkBarcodeInput, 10); +}); + + + + + + + [% IF ( Koha.Preference('SelfCheckInUserJS') ) %] -- 2.39.5