Bug 11812 - Add missing "required" indicator to fields which are required
authorOwen Leonard <oleonard@myacpl.org>
Fri, 21 Feb 2014 14:44:21 +0000 (09:44 -0500)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 22 Oct 2014 17:04:43 +0000 (14:04 -0300)
Form fields in the staff client which are required should be configured
to be so by doing several things:

- Add a class "required" to the field's <label>
- Add a class "required" to the form field
- Add 'required="required"' to the form field
- Apppend a <span class="required">Required</span> after the form field.

Several places in the templates are missing the <span>. This patch adds
them.

To test, apply the patch and view the following pages to confirm that
the "Required" text appears:

- Acquisitions -> Add an order to a basket from a new (empty) record.
  Title, quantity, and fund should indicate they are required.

- Administration -> Authority types ->  New authority type. The
  authority type and description fields should indicate they are
  required.

- Administration -> Authority types -> MARC structure -> New tag. The
  tag field should indicate it is required.

- Patron types and categories -> New category. Category code,
  description, and category type should indicate that they are required.
  FIXME: Enrollment period is required but the user must choose one. I'm
  not sure how to handle that clearly.

- Tools -> CSV profiles. Profile name, profile type, and profile MARC
  fields should indicate they are required on both the new and edit
  forms.

- Administration -> Manage MARC modification templates. Under "Create a
  new template" the name field should indicate that it is required.

- Tools -> Batch patron modification -> Submit a batch for editing. Any
  fields which are required according to your BorrowerMandatoryField
  system preference should indicate that they are required.

Patch behaves as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
QA Edits: Re-worded the "required" not on the batch patron edit form,
added a missing word to the help text on that page. On the csv-profiles
page I removed an unnecessary "javascript:" protocol from the markup.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works and passes QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt

index 64ad028..72dfeca 100644 (file)
@@ -258,6 +258,7 @@ $(document).ready(function()
             [% ELSE %]
             <label for="entertitle" class="required">Title: </label>
                 <input type="text" id="entertitle" size="50" name="title" value="[% title |html %]" class="focus" />
+                <span class="required">Required</span>
             [% END %]
         </li>
         <li>
@@ -422,6 +423,7 @@ $(document).ready(function()
                             <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
                         [% END %]
                     [% END %]
+                    <span class="required">Required</span>
                 [% END %]
                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
@@ -454,6 +456,7 @@ $(document).ready(function()
                     </option>
                 [% END %]
                 </select>
+                <span class="required">Required</span>
                 <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
                 <input type="checkbox" id="showallbudgets" />
                 [% END %]
index eabcf9e..0480bf5 100644 (file)
                         [% searchfield %]
                     </li>
                 [% ELSE %]
-                    <li><label for="tagfield" class="required">Tag: </label><input type="text" id="tagfield" name="tagfield" size="5" maxlength="3" required="required" class="required" /></li>
+                    <li>
+                        <label for="tagfield" class="required">Tag: </label><input type="text" id="tagfield" name="tagfield" size="5" maxlength="3" required="required" class="required" />
+                        <span class="required">Required</span>
+                    </li>
                 [% END %]
 
         <li><label for="liblibrarian">Text for librarians: </label><input type="text" name="liblibrarian" id="liblibrarian" value="[% liblibrarian |html %]" size="40" maxlength="100" /></li>
index 2c12808..691dfe2 100644 (file)
     [% ELSE %]
             <label for="authtypecode" class="required">Authority type: </label>
             <input id="authtypecode" type="text" class="required" required="required" name="authtypecode" size="10" maxlength="10" onblur="toUC(this)" />
+            <span class="required">Required</span>
     [% END %]
         </li>
-        <li><label for="authtypetext" class="required">Description: </label><input type="text" id="authtypetext" name="authtypetext" size="40" maxlength="80" value="[% authtypetext |html %]" class="required" required="required" /></li>
+        <li>
+            <label for="authtypetext" class="required">Description: </label><input type="text" id="authtypetext" name="authtypetext" size="40" maxlength="80" value="[% authtypetext |html %]" class="required" required="required" />
+            <span class="required">Required</span>
+        </li>
                <li><label for="summary">Summary: </label><textarea id="summary" name="summary" cols="55" rows="7">[% summary %]</textarea></li>
                <li>
                <p class="tip">Note: for 'Authority field to copy', enter the authority field that should be copied from the authority record to the bibliographic record. E.g., in MARC21, field 100 in the authority record should be copied to field 100 in the bibliographic record</p>
index d03309a..a2ad329 100644 (file)
     <li><span class="label">Category code: </span>[% categorycode |html %]
                                <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
        [% ELSE %]
-    <li><label for="categorycode" class="required">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
+    <li>
+        <label for="categorycode" class="required">Category code: </label>
+        <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
+        <span class="required">Required</span>
+    </li>
        [% END %]
-    <li><label for="description" class="required">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
+    <li>
+        <label for="description" class="required">Description: </label>
+        <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" />
+        <span class="required">Required</span>
+    </li>
     <li><label for="enrolmentperiod" class="required">Enrollment period: </label>
        <fieldset>
        <legend>Choose one</legend>
                        [% END %]
                                        </select></li>
        <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
-    <li><label for="category_type" class="required">Category type: </label> <select name="category_type" id="category_type">
+    <li>
+        <label for="category_type" class="required">Category type: </label>
+        <select name="category_type" id="category_type">
                         [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
                                        [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
                                        [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
                                        [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
                                        [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
                                        </select>
+        <span class="required">Required</span>
     </li>
     <li><label for="branches">Branches limitation: </label>
         <select id="branches" name="branches" multiple size="10">
index afcb95c..7bbb0e4 100644 (file)
@@ -87,8 +87,11 @@ function reloadPage(p) {
                         <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
                                                <fieldset class="rows">
                           <ol>
-                            <li><label for="profile_name" class="required">Profile name: </label>
-                            <input type="text" id="profile_name" name="profile_name" required="required" /></li>
+                            <li>
+                                <label for="profile_name" class="required">Profile name: </label>
+                                <input type="text" id="profile_name" name="profile_name" required="required" />
+                                <span class="required">Required</span>
+                            </li>
 
                             <li>
                               <label for="profile_type" class="required">Profile type: </label>
@@ -96,6 +99,7 @@ function reloadPage(p) {
                                 <option value="marc" selected="selected">MARC</option>
                                 <option value="sql">SQL</option>
                               </select>
+                              <span class="required">Required</span>
                             </li>
 
                                                    <li><label for="profile_description">Profile description: </label>
@@ -152,8 +156,10 @@ function reloadPage(p) {
                                                    </select></li>
 
 
-                            <li class="marc_specific"><label for="new_profile_marc_content" class="required">Profile MARC fields: </label>
-                            <textarea cols="50" rows="2" name="profile_marc_content" id="new_profile_marc_content"></textarea>
+                            <li class="marc_specific">
+                                <label for="new_profile_marc_content" class="required">Profile MARC fields: </label>
+                                <textarea cols="50" rows="2" name="profile_marc_content" id="new_profile_marc_content"></textarea>
+                                <span class="required">Required</span>
                                                    <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
                             <p>You can also use your own headers (instead of the ones from Koha) by prefixing the field number with an header, followed by the equal sign.</p>
                                                    <p>Example: Personal name=200|Entry element=210$a|300|009</p>
@@ -180,7 +186,7 @@ function reloadPage(p) {
                                                <fieldset class="rows">
                             <ol>
                             <li><label for="modify_profile_name" class="required">Profile name: </label>
-                                                   <select id="modify_profile_name" name="profile_name" onchange="javascript:reloadPage(this)">
+                                <select id="modify_profile_name" name="profile_name" required="required" class="required" onchange="reloadPage(this)">
                                                        <option value="0">-- Choose One --</option>
                                                        [% FOREACH existing_profile IN existing_profiles %]
                                                        [% IF ( existing_profile.export_format_id == selected_profile_id ) %]
@@ -189,11 +195,13 @@ function reloadPage(p) {
                                                        <option value="[% existing_profile.export_format_id %]">[% existing_profile.profile %]</option>
                                                        [% END %]
                                                        [% END %]
-                                                   </select></li>
+                            </select>
+                            <span class="required">Required</span>
+                            </li>
 
                             <li>
                               <label for="modify_profile_type" class="required">Profile type: </label>
-                              <select id="modify_profile_type" name="profile_type">
+                              <select id="modify_profile_type" name="profile_type" class="required" required="required">
                                 <option value="marc">MARC</option>
                                 [% IF selected_profile_type == "sql" %]
                                   <option value="sql" selected="selected">SQL</option>
@@ -201,6 +209,7 @@ function reloadPage(p) {
                                   <option value="sql">SQL</option>
                                 [% END %]
                               </select>
+                                <span class="required">Required</span>
                             </li>
 
 
@@ -352,8 +361,11 @@ function reloadPage(p) {
                                                        [% END %]
                                                    </select></li>
 
-                            <li class="marc_specific"><label for="modify_profile_marc_content" class="required">Profile MARC fields: </label>
-                            <textarea cols="50" rows="2" name="profile_marc_content" id="modify_profile_marc_content">[% selected_profile_content %]</textarea></li>
+                            <li class="marc_specific">
+                                <label for="modify_profile_marc_content" class="required">Profile MARC fields: </label>
+                                <textarea cols="50" rows="2" name="profile_marc_content" id="modify_profile_marc_content" class="required" required="required">[% selected_profile_content %]</textarea>
+                                <span class="required">Required</span>
+                            </li>
 
                             <li class="sql_specific">
                               <label for="modify_profile_sql_content" class="required">Profile SQL fields: </label>
index 6253135..690c4e4 100644 (file)
@@ -501,12 +501,13 @@ function setSelectByValue( selectId, value ) {
                 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
             [% END %]
 
-            <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" >
+            <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
                 <fieldset>
                     <legend>Create a new template</legend>
 
                     <label for="template_name" class="required">Name: </label>
-                    <input name="template_name" id="template_name" type="text" size="30" required="required" />
+                    <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
+                    <span class="required">Required</span>
 
                     <input type="hidden" name="op" value="create_template" />
                     <input type="submit" value="Create template" />
index 6f58934..e6228cc 100644 (file)
                             [% IF ( op == 'show' ) %]
                             <div id="cataloguing_additem_newitem">
                                 <h2>Edit patrons</h2>
-                                <div class="hint">Checking the box right next the label will disable the entry and delete the values of that field on all selected patrons</div>
+                                <div class="hint">Checking the box right next to the label will disable the entry and delete the values of that field on all selected patrons</div>
                                 <fieldset class="rows" id="fields_list">
                                     <ol>
                                         [% FOREACH field IN fields %]
                                             [% IF ( field.type == 'date' ) %]
                                                 <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" />
                                                 <a href="#" class="clear-field" onclick="clearDate('[% field.name %]');return false;">Clear</a>
-                                                [% END %]
+                                            [% END %]
+                                            [% IF field.mandatory %]
+                                                <span class="required">Required fields cannot be cleared</span>
+                                            [% END %]
                                         </li>
                                         [% END %]
                                         [% IF ( patron_attributes_codes ) %]