[Koha-patches] [PATCH] Bug 11806 - Use validation plugin when creating new OAI set
Owen Leonard
oleonard at myacpl.org
Thu Feb 20 22:10:57 CET 2014
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.
---
.../prog/en/modules/admin/oai_sets.tt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt
index a480b74..02eaf39 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt
@@ -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>
--
1.7.9.5
More information about the Koha-patches
mailing list