From: Nick Duncan Date: Mon, 28 Sep 2015 22:36:35 +0000 (-0400) Subject: KMAIN-1830 Backspace clears patron register barcode X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4fe6935ba6a7a163ab07e28180701b6ce764d07d;p=working%2FEvergreen.git KMAIN-1830 Backspace clears patron register barcode Backspace Now Completely Clears Barcode Field When Doing A Patron Registration. Signed-off-by: Nick Duncan Modified by Bill E. for style, to avoid unnecessary dojo.attach, and to add some comments. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index c575f232b5..9b95e7591e 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1542,6 +1542,20 @@ function attachWidgetEvents(fmcls, fmfield, widget) { ); } ); + + // when creating a new patron, a backspace in the barcode + // entry field clears the barcode and username values. + if (patron.isnew()) { + dojo.connect(dojo.byId("barcode"), "onkeypress", + function(event) { + if (event.keyCode != 8) return // 8 = Backspace Key + findWidget('au', 'usrname').widget.attr('value', ''); + findWidget('ac', 'barcode').widget.attr('value', ''); + findWidget('ac', 'barcode').widget.attr('required', true); + } + ); + } + return; } }