Bug 11806 - Use validation plugin when creating new OAI set
authorOwen Leonard <oleonard@myacpl.org>
Thu, 20 Feb 2014 21:08:02 +0000 (16:08 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 26 Mar 2014 19:21:14 +0000 (19:21 +0000)
The form for adding a new OAI indicates that two fields are
required but does nothing to enforce this rule. This can be
handled client-side with HTML5 validation attributes and Koha's built-in
validation plugin. This patch implements this.

To test, apply the patch and go to Administration -> OAI sets
configuration -> New set. Try submitting the form without entering a
setSpec and/or setName. Doing so should trigger a validation warning.

Submission of the form with valid data should work correctly. Editing an
existing set should also work correctly.

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt

index a480b74..02eaf39 100644 (file)
@@ -32,7 +32,7 @@ function delDescField(minusButton) {
   <div id="yui-main">
     <div class="yui-b">
         [% IF ( op_new || op_mod ) %]
-            <form method="post" action="/cgi-bin/koha/admin/oai_sets.pl">
+            <form method="post" action="/cgi-bin/koha/admin/oai_sets.pl" class="validated">
             [% IF ( op_new ) %]
                 <h2>Add a new OAI set</h2>
                 <input type="hidden" name="op" value="savenew" />
@@ -45,11 +45,13 @@ function delDescField(minusButton) {
                     <ol>
                         <li>
                             <label for="spec" class="required">setSpec: </label>
-                            <input type="text" id="spec" name="spec" value="[% spec %]" />
+                            <input type="text" id="spec" name="spec" value="[% spec %]" required="required" class="required" />
+                            <span class="required">Required</span>
                         </li>
                         <li>
                             <label for="name" class="required">setName: </label>
-                            <input type="text" id="name" name="name" value="[% name %]" />
+                            <input type="text" id="name" name="name" value="[% name %]" required="required" class="required" />
+                            <span class="required">Required</span>
                         </li>
                         [% FOREACH desc IN descriptions %]
                             <li>