Bug 9137 - Focus when editing/adding new itemtypes/authorised values

This patch adds the "focus" class to the relevant inputs so
that the global staff client JS will move the focus to those fields.
Logic in the authorised_values template puts the focus on the
correct field whether you're adding a new category, a new value,
or performing an edit.

To test, try the following operations:
 - add an itemtype
 - edit an itemtype
 - add an authorised value category
 - add an authorised value value
 - edit an authorised value value

In all cases the focus should automatically be in the first
form field.

Signed-off-by: Melia Meggs <melia@test.bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass and works nicely.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Works well in 3.10.x
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Works well in 3.8.x

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2012-11-26 10:49:22 -05:00 committed by Liz Rea
parent a7277ff28a
commit a8a191bcb3
2 changed files with 11 additions and 3 deletions

View File

@ -59,7 +59,7 @@
<fieldset class="rows"><ol>
<li>
[% IF ( action_add_category ) %]<label for="category">Category</label>
<input type="text" name="category" id="category" size="10" maxlength="10" />
<input type="text" name="category" id="category" size="10" maxlength="10" class="focus" />
[% ELSE %]<span class="label">Category</span>
<input type="hidden" name="category" value="[% category %]" /> [% category %]
[% END %]
@ -67,7 +67,11 @@
<li>
<label for="authorised_value">Authorized value</label>
[% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
[% IF ( action_add_category ) %]
<input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" />
[% ELSE %]
<input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" />
[% END %]
</li>
<li>
<label for="lib">Description</label>

View File

@ -167,11 +167,15 @@ Item Types Administration
</li>
[% ELSE %]
<li>
<label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" />
<label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" class="focus" />
</li>
[% END %]
<li>
<label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /> </li>
[% IF ( itemtype ) %]
<label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" class="focus" /></li>
[% ELSE %]
<label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /></li>
[% END %]
[% IF ( noItemTypeImages ) %]
<li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
[% ELSE %]</ol>