Setting focus on form fields
authorOwen Leonard <oleonard@myacpl.org>
Sat, 18 Apr 2009 21:45:22 +0000 (16:45 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Sat, 18 Apr 2009 23:36:11 +0000 (18:36 -0500)
This patch includes an addition to the OPAC's default js (identical to one in the staff client) which lets you add a "focus" class to an element on the page and have javascript move the focus to that element (input or link).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
koha-tmpl/opac-tmpl/prog/en/js/script.js
koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasketform.tmpl
koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelfform.tmpl

index b3e3a16..76a6c91 100644 (file)
@@ -11,6 +11,7 @@ $(document).ready(function(){
        $(".close").click(function(){
                window.close();
        });
+       $(".focus").focus();
        // clear the basket when user logs out
        $("#logout").click(function(){
                var nameCookie = "bib_list";
index c162a9d..9caef3c 100644 (file)
@@ -7,7 +7,7 @@
        <!-- TMPL_IF NAME="SENT" -->
                <h3>Message Sent</h3>
            <p>The cart was sent to: <!-- TMPL_VAR NAME="email_add" --></p>
-               <p><a class="close" href="#">Close window</a></p>
+               <p><a class="focus close" href="#">Close window</a></p>
        <!-- /TMPL_IF  -->
        <!-- TMPL_IF NAME="error" -->
        <p>Problem sending the cart...</p>
@@ -21,7 +21,7 @@
 <legend>Sending your cart</legend>
 <ol>   <li>
         <label for="email_add">Email Address:</label>
-        <input type="text" id="email_add" name="email_add" size="43" />
+        <input type="text" id="email_add" name="email_add" size="43" class="focus" />
     </li>
     <li>
             <label for="comment">Comment:</label>
index c4c33f9..41f7d32 100644 (file)
@@ -7,7 +7,7 @@
     <!-- TMPL_IF NAME="SENT" -->
         <h3>Message Sent</h3>
         <p>The list was sent to: <!-- TMPL_VAR NAME="email" --></p>
-        <p><a class="close" href="#">Close window</a></p>
+        <p><a class="close focus" href="#">Close window</a></p>
     <!-- /TMPL_IF  -->
     <!-- TMPL_IF NAME="error" -->
     <p>Problem sending the list...</p>
@@ -21,7 +21,7 @@
 <legend>Sending your list</legend>
 <ol>   <li>
         <label for="email">Email Address:</label>
-        <input type="text" id="email" name="email" size="43" />
+        <input type="text" id="email" name="email" size="43" class="focus" />
     </li>
     <li>
             <label for="comment">Comment:</label>