Bug 24606: (QA follow-up) Disable 'Apply template' button if no template is selected
authorKyle Hall <kyle@bywatersolutions.com>
Mon, 31 Oct 2022 16:16:27 +0000 (12:16 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 10 Nov 2022 17:25:53 +0000 (14:25 -0300)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js

index 5d483f0..ba2a40e 100644 (file)
@@ -88,11 +88,19 @@ $(document).ready(function(){
     });
 
     $("#template_id").on("change", function() {
-        if ( $(this).find(":selected").data("editor") ) {
+        let option = $(this).find(":selected");
+
+        if ( option.data("editor") ) {
             $("#delete_template_submit").removeAttr("disabled");
         } else {
             $("#delete_template_submit").attr("disabled", "disabled");
         }
+
+        if ( option.val() != 0 ) {
+            $("#load_template_submit").removeAttr("disabled");
+        } else {
+            $("#load_template_submit").attr("disabled", "disabled");
+        }
     });
     $("#template_id").change(); // Trigger to enable delete button if patron's template is in use
     $("#replace_template_id").on("change", function() {