From 4ea25b8ab26bd36c05473e3ed80117d4400d22ec Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Fri, 17 Jan 2025 13:59:13 +0100 Subject: [PATCH] Fix update button --- app/templates/service_creds.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/templates/service_creds.html b/app/templates/service_creds.html index fde00154..35edd418 100644 --- a/app/templates/service_creds.html +++ b/app/templates/service_creds.html @@ -196,13 +196,15 @@ $(".updateBtn").click(function () { var button = $(event.relatedTarget) // Button that triggered the modal var cred_id = button.data('id') - // add spinner to button - $(this).parent().find(".updateBtn").addClass("disabled", true); - $(this).addClass("updateBtn", true); - if (cred_id == "") { - $(this).html( ` Adding ...` ); - } else { - $(this).html( ` Updating...` ); + if ($('#credForm')[0].checkValidity()) { + // add spinner to button + $(this).parent().find(".updateBtn").addClass("disabled", true); + $(this).addClass("updateBtn", true); + if (cred_id == "") { + $(this).html( ` Adding ...` ); + } else { + $(this).html( ` Updating...` ); + } } }); });