From ce03c27aa2d9fc1d28296d468920ad7f26a869fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauro=20Ferr=C3=A3o?= Date: Mon, 2 Sep 2024 12:23:27 +0100 Subject: [PATCH] Fix validation for hidden inputs (#2726) relates to xibosignageltd/xibo-private#835 --- ui/src/core/xibo-cms.js | 5 +++-- views/notification-page.twig | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/src/core/xibo-cms.js b/ui/src/core/xibo-cms.js index 68797ffb50..0a51266797 100644 --- a/ui/src/core/xibo-cms.js +++ b/ui/src/core/xibo-cms.js @@ -277,8 +277,9 @@ function XiboInitialise(scope, options) { $(scope + ' .XiboForm').validate({ submitHandler: XiboFormSubmit, // Ignore the date picker helpers - ignore: '.datePickerHelper', - errorElement: "span", + // and input groups that are hidden + ignore: '.datePickerHelper, :hidden>*:not(.flatpickr-input)', + errorElement: 'span', errorPlacement: function(error, element) { if($(element).hasClass('dateControl')) { // Places the error label date controller diff --git a/views/notification-page.twig b/views/notification-page.twig index f0de0fb5af..2dfa1edfa3 100644 --- a/views/notification-page.twig +++ b/views/notification-page.twig @@ -211,9 +211,9 @@ // NOTE: The validation plugin does not like binding to multiple forms at once. dialog.find("#notificationForm").validate({ submitHandler: attachmentFormSubmit, - errorElement: "span", + errorElement: 'span', // Ignore the date picker helpers - ignore: '.datePickerHelper', + ignore: '.datePickerHelper, :hidden>*:not(.flatpickr-input)', errorPlacement: function(error, element) { if($(element).hasClass('dateControl')) { // Places the error label date controller