From 564ed4d444a8e35ff1a611a190c1398692ec7972 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 18 Feb 2014 15:37:31 -0500 Subject: [PATCH] Bug 11789 - Use validation plugin when creating new list Content-Type: text/plain; charset="utf-8" The page for adding a new list 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. Other edits: Minor validation fixes. To test, apply the patch and go to Lists -> New list. Try submitting the form without entering a list name. This should trigger a validation warning. Submission of the form with valid data should work correctly. Editing an existing list should also work correctly. Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart --- .../prog/en/modules/virtualshelves/shelves.tt | 41 +++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 95fa4b9..aca9485 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -155,26 +155,7 @@ function placeHold () { $("#hold_form").submit(); return false; } - /** - * This function checks to make sure a list title is assigned - */ - function Check(f) { - var _alertString=""; - var alertString2; - - if($("#shelfname").val() == ""){ - _alertString += "- "+_("You must enter a List Name") + "\n"; - } - if (_alertString.length==0) { - f.submit(); - } else { - alertString2 = _("Form not submitted because of the following problem(s)"); - alertString2 += "\n------------------------------------------------------------------------------------\n\n"; - alertString2 += _alertString; - alert(alertString2); - } - } function cartList(){ var checkboxes = $("#searchresults").find(":checkbox"); var vshelf = vShelfAdd(checkboxes); @@ -440,14 +421,16 @@ function placeHold () { [% IF ( seflag ) %]
-
+
[% IF ( shelves ) %] - Create a new list +
    -
  1. +
  2. + Required +
  3. Owner: [% loggedinusername %]
  4. + Edit list [% shelfname | html %] + [% IF ( showprivateshelves ) %][% END %] - - Edit list [% shelfname | html %] +
      -
    1. +
    2. + Required +
    3. [% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]
    4. + +
      [% IF ( showprivateshelves ) %] Cancel [% ELSE %] @@ -516,7 +502,6 @@ function placeHold () {
      • A Private list is managed by you and can be seen only by you.
      • A Public list can be seen by everybody, but managed only by you.
      • -
      • The owner of a list is always allowed to add entries, but needs permission to remove.
      -- 1.7.9.5