KMAIN-1643 Text Cursor Automatically Placed on Vendor Invoice ID
authorDan Reuther <dreuther@catalystitservices.com>
Fri, 17 Jul 2015 16:33:10 +0000 (12:33 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Set the focus to the Vendor Invoice ID field on invoice create
and view screens.

Signed-off-by: Dan Reuther <dreuther@catalystitservices.com>
modified:   Open-ILS/web/js/ui/default/acq/invoice/view.js

Open-ILS/web/js/ui/default/acq/invoice/view.js

index 4888d5e..283e6f6 100644 (file)
@@ -87,6 +87,13 @@ function init2() {
 
     dojo.byId('acq-invoice-summary-toggle-on').onclick = function() {
         openils.Util.show(dojo.byId('acq-invoice-summary'));
+
+        // Set the focus to the Vendor Invoice ID field.  Might be a bit brittle since the
+        // element ID is generated dynamically by a dojo widget.  It should be ok since it
+        // sets the focus to the first element which seems to be the logical place.
+        // This sets the focus when the invoice brief is displayed by the toggle button.
+        // It is also set a few line down for the initial page load.
+        document.getElementById('dijit_form_ValidationTextBox_0').focus();
         openils.Util.hide(dojo.byId('acq-invoice-summary-small'));
     }
 
@@ -120,6 +127,9 @@ function init2() {
         parentNode : dojo.byId('acq-invoice-extra-copies-fund')
     });
     extraCopiesFund.build();
+
+    // Set the initial focus field.  See comment above for additional notes
+    document.getElementById('dijit_form_ValidationTextBox_0').focus();
 }
 
 function renderInvoice() {