Subject: [PATCH] [Signed off] Bug 7469 - Focus on 1st field of creation form instead of search textbox (Acquisition)

From: Fridolyn SOMERS <[email-masked]>
Date: Tue, 6 Aug 2013 14:21:10 +0200

When a user creates a new vendor, a new borrower or a new basket (maybe on others pages too, to be listed), a creation form is displayed, but the focus is still on the search textbox on page top.
It would be probably better to switch the focus to the first field of the creation form.

This patch adds the focus, for acquisition module, on first input for pages with a data creation or modification or pages with only one form (like Z3950 search).

Test plan :
Go to pages and look where is the focus :
- acqui/basketgroup.pl : focus on "Basket group name:"
- acqui/basketheader.pl : focus on "Basket name:"
- acqui/invoices.tt : focus on "Invoice no:"
- acqui/modordernotes.pl : focus on "Notes:"
- acqui/neworderempty.pl : focus on "Title:"
- acqui/supplier.pl : focus on "Name:"
- acqui/z3950_search.pl : focus on "Title:"

Signed-off-by: Melia Meggs <[email-masked]>
---
 .../prog/en/modules/acqui/basketgroup.tt           |    2 +-
 .../prog/en/modules/acqui/basketheader.tt          |    2 +-
 .../prog/en/modules/acqui/invoices.tt              |    2 +-
 .../prog/en/modules/acqui/modordernotes.tt         |    2 +-
 .../prog/en/modules/acqui/neworderempty.tt         |    2 +-
 .../prog/en/modules/acqui/supplier.tt              |    2 +-
 .../prog/en/modules/acqui/z3950_search.tt          |    2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
index 6bb0048..4855563 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
@@ -183,7 +183,7 @@ function submitForm(form) {
 					<fieldset id="various" class="brief">
 					<ol>
                         <li><label for="basketgroupname">Basket group name:</label>
-							<input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" /></li>
+							<input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" class="focus" /></li>
                         <li><label for="billingplace">Billing place:</label>
 							<select name="billingplace" id="billingplace" style="width:13em;">
                                 <option value="">--</option>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
index 49e704a..85fc946 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
@@ -66,7 +66,7 @@ function Check(ff) {
                 [% END %]
                 <li>
                     <label for="basketname" class="required">Basket name: </label> &nbsp;
-                        <input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname %]" />
+                        <input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname %]" class="focus" />
                 </li>
                  <li>
                     <label for="billingplace">Billing place:</label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
index 16c1b61..83d1838 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
@@ -147,7 +147,7 @@ $(document).ready(function() {
         <ol>
           <li>
             <label for="invoicenumber">Invoice no:</label>
-            <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" />
+            <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" class="focus" />
           </li>
           <li>
             <label for="supplier">Vendor:</label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt
index 0961f4a..6fc4867 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt
@@ -16,7 +16,7 @@
       <form action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
         <fieldset class="brief">
           <label for="ordernotes">Notes:</label>
-          <textarea id="ordernotes" name="ordernotes" rows="3" cols="30">[% ordernotes %]</textarea>
+          <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes %]</textarea>
         </fieldset>
         <input type="hidden" name="referrer" value="[% referrer %]" />
         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
index 52def80..2535fed 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -239,7 +239,7 @@ $(document).ready(function()
                 <input type="hidden" name="title" value="[% title |html %]" /> <span class="title">[% title |html %]</span>
             [% ELSE %]
             <label for="entertitle" class="required">Title: </label>
-                <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" />
+                <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" class="focus" />
             [% END %]
         </li>
         <li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
index 16b2fd1..828242f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
@@ -68,7 +68,7 @@ if (f.company.value == "") {
         <fieldset class="rows">
             <legend>Company details</legend>
             <ol><li><label for="company" class="required">Name: * </label>
-                <input type="text" size="40" id="company" name="company" value="[% name %]" /></li>
+                <input type="text" size="40" id="company" name="company" value="[% name %]" class="focus" /></li>
             <li><label for="company_postal">Postal address: </label>
                     <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal %]</textarea></li>
             <li><label for="physical">Physical address: </label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
index 7ce0222..f06b4a7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
@@ -92,7 +92,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
 	<div class="yui-g">
     <div class="yui-u first">
 	    <fieldset class="rows">
-		 <ol><li><label for="searchtitle">Title: </label> <input type="text" id="searchtitle"  name="title" value="[% title |html %]" /></li>
+         <ol><li><label for="searchtitle">Title: </label> <input type="text" id="searchtitle"  name="title" value="[% title |html %]" class="focus" /></li>
 		 <li><label for="isbn">ISBN: </label> <input type="text" id="isbn" name="isbn" value="[% isbn %]" /></li>
          <li><label for="lccall">LC call number: </label> <input type="text" id="lccall" name="lccall" value="" /></li>
          <li><label for="controlnumber">Control no.: </label> <input type="text" id="controlnumber" name="controlnumber" value="" /></li>
-- 
1.7.2.5