Bugzilla – Attachment 25407 Details for
Bug 11788
Use validation plugin when creating new course
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11788 - Use validation plugin when creating new course
Bug-11788---Use-validation-plugin-when-creating-ne.patch (text/plain), 5.10 KB, created by
Chris Cormack
on 2014-02-19 00:28:23 UTC
(
hide
)
Description:
Bug 11788 - Use validation plugin when creating new course
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-02-19 00:28:23 UTC
Size:
5.10 KB
patch
obsolete
>From a0d2bfa0ec552d257b9262f7f01b81b1219dcc5e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 18 Feb 2014 15:26:30 -0500 >Subject: [PATCH] Bug 11788 - Use validation plugin when creating new course > >The page for adding a new course 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 Course reserves -> New course. Try >submitting the form without entering a department, course number, >and/or course name. This should trigger validation warnings. > >Submission of the form with valid data should work correctly. Editing an >existing course should also work correctly. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > .../prog/en/modules/course_reserves/course.tt | 45 ++++------------------ > 1 file changed, 8 insertions(+), 37 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >index b9daa0a..a485b22 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >@@ -6,38 +6,6 @@ > > <script type="text/javascript"> > //<![CDATA[ >- >- function Check(f) { >- var _alertString = ""; >- >- if( ! $("#department").val() ) { >- _alertString += _("- You must choose a department") + "\n"; >- } >- >- if( ! $("#course_number").val() ) { >- _alertString += _("- You must choose a course number") + "\n"; >- } >- >- if( ! $("#course_name").val() ) { >- _alertString += _("- You must add a course name") + "\n"; >- } >- >- if ( _alertString.length ) { >- var alertHeader; >- alertHeader = _("Form not submitted because of the following problem(s)"); >- alertHeader += "\n------------------------------------------------------------------------------------\n\n"; >- >- alert( alertHeader + _alertString ); >- } else { >- f.submit(); >- } >- } >- >- //]]> >- </script> >- >- <script type="text/javascript"> >- //<![CDATA[ > $(document).ready(function(){ > $( "#find_instructor" ).autocomplete({ > source: "/cgi-bin/koha/circ/ysearch.pl", >@@ -100,14 +68,14 @@ > > <div id="doc" class="yui-t7"> > <div id="bd"> >- <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl"> >+ <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl" class="validated"> > [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id %]" />[% END %] > <fieldset class="rows"> > <legend>[% IF course_id %]Edit course[% ELSE %]Create course[% END %]</legend> > <ol> > <li> > <label class="required" for="department">Department:</label> >- <select id="department" name="department"> >+ <select id="department" name="department" required="required" class="required"> > <option value="">Select a department</option> > > [% FOREACH d IN departments %] >@@ -118,11 +86,13 @@ > [% END %] > [% END %] > </select> >+ <span class="required">Required</span> > </li> > > <li> > <label class="required" for="course_number">Course number:</label> >- <input id="course_number" name="course_number" type="text" value="[% course_number %]" /> >+ <input id="course_number" name="course_number" type="text" value="[% course_number %]" required="required" class="required" /> >+ <span class="required">Required</span> > </li> > > <li> >@@ -132,7 +102,8 @@ > > <li> > <label class="required" for="course_name">Course name:</label> >- <input id="course_name" name="course_name" type="text" value="[% course_name %]" /> >+ <input id="course_name" name="course_name" type="text" value="[% course_name %]" required="required" class="required" /> >+ <span class="required">Required</span> > </li> > > <li> >@@ -195,7 +166,7 @@ > </fieldset> > > <fieldset class="action"> >- <input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" /> >+ <input type="submit" value="Save" class="submit" /> > > <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a> > </fieldset> >-- >1.8.5.3
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 11788
:
25395
|
25407
|
25482