Bugzilla – Attachment 50596 Details for
Bug 16299
Use validation plugin when creating a patron attribute type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16299 - Use validation plugin when creating a patron attribute type
Bug-16299---Use-validation-plugin-when-creating-a-.patch (text/plain), 5.07 KB, created by
Jonathan Druart
on 2016-04-23 06:54:12 UTC
(
hide
)
Description:
Bug 16299 - Use validation plugin when creating a patron attribute type
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-04-23 06:54:12 UTC
Size:
5.07 KB
patch
obsolete
>From 1c1ce826783cb013222b6749c8a29d3488d12503 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 19 Apr 2016 13:58:12 -0400 >Subject: [PATCH] Bug 16299 - Use validation plugin when creating a patron > attribute type >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch replaces custom client-side form validation with use of the >jQuery validation plugin. Besides reducing the amount of code in the >template, this allows us to eliminate use of "onclick." > >This patch also makes a correction for HTML validity: <option value="" >/> is not accepted. I have also added an id attribute to a <select> >which lacked it. > >To test, apply the patch and go to Administration -> Patron attribute >types. > >- Test creating a new patron attribute type. Try to submit the form > without a code, description, or both. You should be prevented from > doing so. >- Test editing an existing patron attribute type. You should not be able > to remove the description and have it save successfully. > >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/modules/admin/patron-attr-types.tt | 51 +++++----------------- > 1 file changed, 10 insertions(+), 41 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >index bb6ed53..384fc57 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >@@ -20,32 +20,6 @@ $(document).ready(function() { > $("#branches option:first").attr("selected", "selected"); > } > } ); >- >-function DoCancel(f) { >- f.op.value=''; >- document.Aform.submit(); >-} >- >-function CheckAttributeTypeForm(f) { >- var ok=1; >- var _alertString=""; >- var alertString2; >- if (f.code.value.length==0) { >- _alertString += "\n- " + _("Patron attribute type code missing"); >- } >- if (f.description.value.length==0) { >- _alertString += "\n- " + _("Description missing"); >- } >- if (_alertString.length==0) { >- document.Aform.submit(); >- } else { >- alertString2 = _("Form not submitted because of the following problem(s)"); >- alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += _alertString; >- alert(alertString2); >- } >-} >- > //]]> > </script> > </head> >@@ -87,7 +61,7 @@ function CheckAttributeTypeForm(f) { > — one with that code already exists. > </div> > [% END %] >-<form action="[% script_name %]" name="Aform" method="post"> >+<form action="[% script_name %]" class="validated" method="post"> > <input type="hidden" name="op" value="[% confirm_op %]" /> > <fieldset class="rows"> > <ol> >@@ -97,13 +71,14 @@ function CheckAttributeTypeForm(f) { > <input type="hidden" name="code" value="[% code |html %]" /> > [% code |html %] > [% ELSE %] >- <label for="code">Patron attribute type code: </label> >- <input type="text" id="code" name="code" size="10" maxlength="10" /> >+ <label for="code" class="required">Patron attribute type code: </label> >+ <input type="text" id="code" name="code" required="required" class="required" size="10" maxlength="10" /> >+ <span class="required">Required</span> > [% END %] > </li> >- <li><label for="description">Description: </label> >- <input type="text" id="description" name="description" size="50" maxlength="250" >- value="[% description |html %]" /> >+ <li><label for="description" class="required">Description: </label> >+ <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% description |html %]" /> >+ <span class="required">Required</span> > </li> > <li><label for="repeatable">Repeatable: </label> > [% IF ( repeatable_checked ) %] >@@ -209,8 +184,8 @@ function CheckAttributeTypeForm(f) { > </li> > <li> > <label for="class">Class: </label> >- <select name="class"> >- <option value="" /> >+ <select name="class" id="class"> >+ <option value=""></option> > [% FOREACH class IN classes_val_loop %] > [% IF class.authorised_value == category_class %] > <option value="[% class.authorised_value %]" selected="selected"> >@@ -228,13 +203,7 @@ function CheckAttributeTypeForm(f) { > </ol> > </fieldset> > <fieldset class="action"> >- [% IF ( edit_attribute_type ) %] >- <input type="button" value="Save" >- onclick="CheckAttributeTypeForm(this.form)" /> >- [% ELSE %] >- <input type="button" value="Save" >- onclick="CheckAttributeTypeForm(this.form)" /> >- [% END %] >+ <input type="submit" value="Save" /> > <a class="cancel" href="/cgi-bin/koha/admin/patron-attr-types.pl">Cancel</a> > </fieldset> > </form> >-- >2.7.0
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 16299
:
50434
|
50499
| 50596