Bugzilla – Attachment 25490 Details for
Bug 11791
Use validation plugin when creating new city
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11791 - Use validation plugin when creating new city
Bug-11791---Use-validation-plugin-when-creating-ne.patch (text/plain), 3.81 KB, created by
Jonathan Druart
on 2014-02-20 11:04:09 UTC
(
hide
)
Description:
Bug 11791 - Use validation plugin when creating new city
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-20 11:04:09 UTC
Size:
3.81 KB
patch
obsolete
>From 8b0613866f7f0528f68317f8e5417a97be633475 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 19 Feb 2014 11:36:30 -0500 >Subject: [PATCH] Bug 11791 - Use validation plugin when creating new city > >The page for adding a new city includes some custom form >validation JavaScript which can be removed in favor of HTML5 validation >attributes and Koha's built-in validation plugin. This patch does so. > >To test, apply the patch and go to Administration -> Cities -> New city. >Try submitting the form without entering a city or zip code. This should >trigger a validation warning. > >Submission of the form with valid data should work correctly. Editing an >existing city should also work correctly. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >Note: This patch changes the behavior. Before the patch, only 1 out of city >and zip was required. Now both are. Since the 2 inputs were marked as >required, I think they should be. >--- > .../intranet-tmpl/prog/en/modules/admin/cities.tt | 19 ++++++------------- > 1 file changed, 6 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >index 8b8cc66..e6acddb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt >@@ -5,13 +5,6 @@ > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > //<![CDATA[ >- function Check(f) { >- if (f.city_zipcode.value.length == 0 && f.city_name.value.length == 0 ) { >- alert(_("City name & zipcode missing")); >- } else{ >- document.Aform.submit(); >- } >- } > $(document).ready(function() { > $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ >@@ -53,7 +46,7 @@ > <h1>New city</h1> > [% END %] > >- <form action="[% script_name %]" name="Aform" method="post"> >+ <form action="[% script_name %]" name="Aform" method="post" class="validated"> > <input type="hidden" name="op" value="add_validate" /> > <input type="hidden" name="checked" value="0" /> > <input type="hidden" name="cityid" value="[% cityid %]" /> >@@ -63,16 +56,16 @@ > <span class="label">City ID: </span>[% cityid %]</li> > [% END %] > <li> >- <label for="city_name" class="required" title="required">City: </label> >- <input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city_name |html %]" /> >+ <label for="city_name" class="required">City: </label> >+ <input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city_name |html %]" required="required" class="required" /> <span class="required">Required</span> > </li> > <li> > <label for="city_state">State: </label> > <input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city_state |html %]" /> > </li> > <li> >- <label for="city_zipcode" class="required" title="required">Zip/Postal code: </label> >- <input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city_zipcode %]" /> >+ <label for="city_zipcode" class="required">Zip/Postal code: </label> >+ <input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city_zipcode %]" required="required" class="required" /> <span class="required">Required</span> > </li> > <li> > <label for="city_country">Country: </label> >@@ -80,7 +73,7 @@ > </li></ol></fieldset> > > <fieldset class="action"> >- <input class="button" type="button" onclick="Check(this.form)" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a> >+ <input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a> > </fieldset> > </form> > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11791
:
25458
|
25477
| 25490