[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4330a43e7f7a60cb62fe2babecc3014c1449bc96

Evergreen Git git at git.evergreen-ils.org
Fri Aug 17 14:14:56 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4330a43e7f7a60cb62fe2babecc3014c1449bc96 (commit)
      from  9f0536984bf32c71b3a42aa3274093757ed1296a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4330a43e7f7a60cb62fe2babecc3014c1449bc96
Author: Dan Scott <dscott at laurentian.ca>
Date:   Mon Jul 30 11:30:50 2012 -0400

    TPAC: Autosuggest focus() throws a JS error
    
    On page load, the Dojo autosuggest code tries to set focus to the
    element with the ID "search_box" - which is fine, except when the page
    does not have said ID. Therefore, test for the existence of the ID
    before setting focus to it.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Art Rhyno <art632000 at yahoo.ca>

diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2
index e4aabb3..b4a775d 100644
--- a/Open-ILS/src/templates/opac/parts/js.tt2
+++ b/Open-ILS/src/templates/opac/parts/js.tt2
@@ -65,13 +65,16 @@
 
     /* Set focus, and place the cursor at the end of the input string */
     dojo.addOnLoad(function() {
-        dijit.byId('search_box').focus();
+        /* Don't error out if the object doesn't exist, like on advanced search pages */
+        if (dojo.byId('search_box')) {
+            dijit.byId('search_box').focus();
 
-        var sb_value = dijit.byId('search_box').value;
-        /* Dojo won't trigger a change if the value doesn't change */
-        if (sb_value) {
-            dijit.byId('search_box').setValue(sb_value + ' ');
-            dijit.byId('search_box').setValue(sb_value);
+            var sb_value = dijit.byId('search_box').value;
+            /* Dojo won't trigger a change if the value doesn't change */
+            if (sb_value) {
+                dijit.byId('search_box').setValue(sb_value + ' ');
+                dijit.byId('search_box').setValue(sb_value);
+            }
         }
     });
 </script>

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/opac/parts/js.tt2 |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list