From 7906b514385062e705b75f4ddb206fe6856ec4f7 Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Fri, 21 Apr 2017 10:48:46 -0400
Subject: [PATCH] Bug 3311: Form validation feedback

By using the validated class, make use of jquery form submission
validation to inform user of required fields.

TEST PLAN
---------
1) run Home -> Reports -> Catalog -> Submit
   -- no meaningful output and no error messages.
2) apply patch
3) repeat 1
   -- meaningful error messages appear.
   -- headings are in red, indicative of required values.
4) try other combinations of row or column selected/unselected.
   -- meaningful error messages.
5) run koha qa test tools

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
---
 .../prog/en/modules/reports/catalogue_stats.tt             | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
index c1f4aab..3e33d3a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
@@ -99,23 +99,27 @@
 	[% END %]
 [% ELSE %]
 
-	<form method="post" action="/cgi-bin/koha/reports/catalogue_stats.pl">
+    <form method="post" class="validated" action="/cgi-bin/koha/reports/catalogue_stats.pl">
 	<fieldset class="rows">
 	<legend>Catalog statistics</legend>
 	<table>
 		<thead>
 			<tr>
 			<th>Title</th>
-			<th>Row</th>
-			<th>Column</th>
+                        <th><label for="Line" class="required">Row</label>
+                            <label for="Line" class="error" style="display: none"><br>A row must be selected.</label>
+                        </th>
+                        <th><label for="Column" class="required">Column</label>
+                            <label for="Column" class="error" style="display: none"><br>A column must be selected.</label>
+                        </th>
 			<th>Filter</th>
 			</tr>
 		</thead>
 		<tbody>
       <tr>
         <td>Koha full call number</td>
-        <td><input type="radio" name="Line" value="items.itemcallnumber" /></td>
-        <td><input type="radio" name="Column" value="items.itemcallnumber" /></td>
+        <td><input type="radio" name="Line" required value="items.itemcallnumber" /></td>
+        <td><input type="radio" name="Column" required value="items.itemcallnumber" /></td>
         <td><label for="callnoFrom">From</label> <input type="text" name="Filter" id="callnoFrom" /> <label for="callnoTo">To</label> <input type="text" name="Filter" id="callnoTo" /></td>
       </tr>
      <tr>
-- 
2.1.4