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 <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Bo Gustavsson 2024-09-04 21:49:47 +02:00 committed by Katrin Fischer
parent bfe67da62d
commit 07d212c024
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -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);
});
</script>
[% IF ( Koha.Preference('SelfCheckInUserJS') ) %]