LP#1622364 Avoid precat dialog submit on ISBN enter
authorBill Erickson <berickxx@gmail.com>
Thu, 21 Sep 2017 19:23:55 +0000 (15:23 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 25 Sep 2017 20:23:10 +0000 (16:23 -0400)
Avoid submitting the precat copy checkout entry form when the Enter key
is pressed on the ISBN field.  Do this to allow scanners to enter ISBN
data without automatically submitting the form.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/circ/share/t_precat_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index 1410f9e..0601782 100644 (file)
@@ -23,6 +23,7 @@
         <div class="form-group">
           <label for="precat-isbn">[% l('ISBN') %]</label>
           <input type="text" class="form-control" id="precat-isbn"
         <div class="form-group">
           <label for="precat-isbn">[% l('ISBN') %]</label>
           <input type="text" class="form-control" id="precat-isbn"
+            ng-keydown="preventSubmit($event)"
             ng-model="precatArgs.dummy_isbn" placeholder="[% l('ISBN...') %]"/>
         </div>
         <div class="form-group">
             ng-model="precatArgs.dummy_isbn" placeholder="[% l('ISBN...') %]"/>
         </div>
         <div class="form-group">
index 27755fe..b8f0d60 100644 (file)
@@ -826,6 +826,13 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
                 $scope.circModifiers = circMods;
                 $scope.ok = function(args) { $uibModalInstance.close(args) }
                 $scope.cancel = function () { $uibModalInstance.dismiss() }
                 $scope.circModifiers = circMods;
                 $scope.ok = function(args) { $uibModalInstance.close(args) }
                 $scope.cancel = function () { $uibModalInstance.dismiss() }
+
+                // use this function as a keydown handler on form
+                // elements that should not submit the form on enter.
+                $scope.preventSubmit = function($event) {
+                    if ($event.keyCode == 13)
+                        $event.preventDefault();
+                }
             }],
             resolve : {
                 circMods : function() { 
             }],
             resolve : {
                 circMods : function() {