Bug 9268 - Scanning in barcode or ISBN in Acquisitions -> new order submits the form...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
index 5cb6357..536d439 100644 (file)
@@ -7,6 +7,24 @@
 [% INCLUDE 'additem.js.inc' %]
 <script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
 <script type="text/javascript">
+var nav = window.Event ? true : false;
+if (nav) {
+    window.captureEvents(Event.KEYDOWN);
+    window.onkeydown = NetscapeEventHandler_KeyDown;
+} else {
+    document.onkeydown = IEEventHandler_KeyDown;
+}
+
+function NetscapeEventHandler_KeyDown(e) {
+    if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; }
+    return true;
+}
+
+function IEEventHandler_KeyDown() {
+    if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
+        return false;
+    return true;
+}
 //<![CDATA[
 actTotal = "";