From 7faff33c8b9bd670cf7813f4cefb7aee38709ebb Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 18 Feb 2014 12:13:39 -0500 Subject: [PATCH] Bug 11785 - Use validation plugin when uploading local cover images When uploading local cover images the form should not be submitted if no file has been selected. The existing form validation script doesn't work. This patch adds HTML5 validation attributes and use of Koha's built-in form validation plugin. To test, apply the patch and go to Tools -> Upload local cover image. Try to submit the form without selecting a file to upload. You should be prevented from doing so. Choose a file and confirm that the upload completes correctly. Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- .../prog/en/modules/tools/upload-images.tt | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt index 0491e18d68..45659950fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt @@ -17,16 +17,12 @@ $(document).ready(function(){ $("#image").click(function(){ $("#bibnum").show(); }); + $("#uploadfile").validate({ + submitHandler: function(form) { + ajaxFileUpload(); + } + }); }); -function CheckForm(f) { - if ($("#fileToUpload").value == '') { - alert(_("Please upload a file first.")); - } else { - return submitBackgroundJob(f); - } - return false; -} - //]]> @@ -72,11 +68,12 @@ function CheckForm(f) {
  1. - - + + + Required
-
+
Upload progress:
0%
-- 2.39.2