diff --git a/app/views/hyrax/admin/appearances/_banner_image_form.html.erb b/app/views/hyrax/admin/appearances/_banner_image_form.html.erb index 867d2f540..9c424ba22 100644 --- a/app/views/hyrax/admin/appearances/_banner_image_form.html.erb +++ b/app/views/hyrax/admin/appearances/_banner_image_form.html.erb @@ -67,6 +67,17 @@ }); document.querySelector('.banner-submit').addEventListener('click', function(e) { + // Get all required fields + var requiredFields = document.querySelectorAll('input[required],textarea[required],select[required]'); + + // Check if all required fields are filled + for (var i = 0; i < requiredFields.length; i++) { + if (!requiredFields[i].value) { + // return early if not all required fields have been filled out + return; + } + } + e.preventDefault(); // Show the spinner