From 77365241f9ce8d2ff5a9c479ba834db840371eb4 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 14 Feb 2014 16:24:10 -0500 Subject: [PATCH] Bug 11771 - Use validation plugin when creating new MARC framework tag Content-Type: text/plain; charset="utf-8" The page for adding a new tag to a MARC framework 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. The patch also moves some tag markup creation out of the script and into the template where it belongs. To test, apply the patch and go to Administration -> MARC bibliographic framework -> MARC structure -> New tag. Try submitting the form without entering a tag number. This should trigger a validation warning. Submission of the form with valid data should work correctly. Editing an existing tag should also work correctly. --- admin/marctagstructure.pl | 12 ++----- .../prog/en/modules/admin/marctagstructure.tt | 37 +++++++++----------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 0326b93..d3b227d 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -126,16 +126,8 @@ if ($op eq 'add_form') { $template->param('use_heading_flags_p' => 1); $template->param(liblibrarian => $data->{'liblibrarian'}, libopac => $data->{'libopac'}, - repeatable => CGI::checkbox(-name=>'repeatable', - -checked=> $data->{'repeatable'}?'checked':'', - -value=> 1, - -label => '', - -id=> 'repeatable'), - mandatory => CGI::checkbox(-name => 'mandatory', - -checked => $data->{'mandatory'}?'checked':'', - -value => 1, - -label => '', - -id => 'mandatory'), + repeatable => $data->{'repeatable'}, + mandatory => $data->{'mandatory'}, authorised_value => $authorised_value, frameworkcode => $frameworkcode, ); # FIXME: move checkboxes to presentation layer diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt index c905f30..7ce8414 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt @@ -10,21 +10,6 @@