[% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
<legend>Log in to your account</legend>
<label for="patronlogin">Login:</label>
- <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
+ <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" />
<label for="patronpw">Password:</label>
<input type="password" id="patronpw" size="20" name="patronpw" />
<fieldset class="action">
return s.substring(index + 1);
}
+$("body").on("keypress", ".noEnterSubmit", function(e){
+ return checkEnter(e);
+});
+
+// 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)
+ characterCode = e.which; //character code is contained in NN4's which property
+ } else {
+ 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)
+ && e.target.nodeName == "INPUT"
+ && e.target.type != "submit" // Allow enter to submit using the submit button
+ ){
+ return false;
+ } else {
+ return true;
+ }
+}
+
// Adapted from https://gist.github.com/jnormore/7418776
function confirmModal(message, title, yes_label, no_label, callback) {
$("#bootstrap-confirm-box-modal").data('confirm-yes', false);