[Koha-bugs] [Bug 2591] Strip Returns From Barcode Scanner on Add Patron & Add Items
bugzilla-daemon at pippin.metavore.com
bugzilla-daemon at pippin.metavore.com
Mon Sep 15 18:41:59 CEST 2008
http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=2591
oleonard at myacpl.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |PATCH-Sent
------- Comment #1 from oleonard at myacpl.org 2008-09-15 09:41 -------
Patch sent which adds this function to staff-global.js:
// http://jennifermadden.com/javascript/stringEnterKeyDetector.html
function checkEnter(e){ //e is event object passed from function invocation
var characterCode; // literal character code will be stored in this
variable
if(e && e.which){ //if which property of event object is supported
(NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's
which property
} else {
e = event;
characterCode = e.keyCode; //character code is contained in
IE's keyCode property
}
if(characterCode == 13){ //if generated character code is equal to
ascii 13 (if enter key)
return false;
} else {
return true;
}
}
--------------------------------
In the page which requires suppression of the <enter> key:
$(document).ready(function(){
$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
});
Where "fieldset.rows input" is the element where suppression should take place.
Could also be a form ID: "#myform input" Specifying "input" allows the enter
key to be used inside textareas.
This solution has been tested in Firefox, Safari, and Internet Explorer 6, all
on Windows.
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the Koha-bugs
mailing list