From a2bd411a0f1ff8fcd6dd4b3c4a8c86cd5009ed21 Mon Sep 17 00:00:00 2001
From: Amit Gupta <amitddng135@gmail.com>
Date: Wed, 9 Oct 2013 13:08:19 +0530
Subject: [PATCH] Bug 11019 - Adding new category in authorized values

If not fill any field it save blank record

To Test:
1) Go to Authorized values.
2) Create New Category.
3) If you not fill the Category field it will not save the record.
---
 .../prog/en/modules/admin/authorised_values.tt     |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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 afdd882..a9fb67e 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
@@ -9,6 +9,15 @@
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
+    function validateForm(){
+        var x=document.forms["Aform"]["category"].value;
+            if (x==null || x=="") {
+                alert("Category is missing");
+                return false;
+            }
+    }
+</script>
+<script type="text/javascript">
 //<![CDATA[
  $(document).ready(function() {
     $("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
@@ -73,7 +82,7 @@ $(document).ready(function() {
 
     [% IF ( action_modify ) %]<div class="note"><strong>NOTE:</strong> If you change an authorized value, existing records using it won't be updated.</div>[% END %]
 
-	<form action="[% script_name %]" name="Aform" method="post">
+	<form action="[% script_name %]" name="Aform" onsubmit="return validateForm()" method="post">
 	<input type="hidden" name="op" value="add_validate" />
     <input type="hidden" name="offset" value="[% offset %]" />
         <fieldset class="rows"><ol>
-- 
1.7.9.5