From eb2926220992e3643b031b3078cd2cb466cdca1c Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Thu, 18 Aug 2016 11:58:42 -0400 Subject: [PATCH] Bug 11019 - Require some fields when adding authorized value category This patch modifies the form for adding an authorized value so that category, authorized value, and description are required fields. Previously a new authorized value category could be saved with no data. To test, apply the patch and go to Administration -> Authorized values. - Click the "New category" button. - Click the save button without filling in category, authorized value, or description. You should be prevented from submitting the form. - Verify that filling in the required fields allows the form to be submitted. - Perform the same test when editing an existing authorized value. Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- .../prog/en/modules/admin/authorised_values.tt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 764fb53..284e018 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -76,28 +76,32 @@ $(document).ready(function() { [% IF ( action_modify ) %]<div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>[% END %] - <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post"> + <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated"> <input type="hidden" name="op" value="add" /> <fieldset class="rows"><ol> <li> - [% IF ( action_add_category ) %]<label for="category">Category: </label> - <input type="text" name="category" id="category" size="32" maxlength="32" class="focus" /> + [% IF ( action_add_category ) %] + <label for="category" class="required">Category: </label> + <input type="text" name="category" id="category" size="32" maxlength="32" class="focus required" /> + <span class="required">Required</span> [% ELSE %]<span class="label">Category</span> <input type="hidden" name="category" value="[% category %]" /> [% category %] [% END %] </li> <li> - <label for="authorised_value">Authorized value: </label> + <label for="authorised_value" class="required">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" /> + <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="required" /> [% ELSE %] - <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" /> + <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus required" /> [% END %] + <span class="required">Required</span> </li> <li> - <label for="lib">Description: </label> - <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="200" /> + <label for="lib" class="required">Description: </label> + <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="200" class="required" /> + <span class="required">Required</span> </li> <li> <label for="lib_opac">Description (OPAC): </label> -- 2.8.1