From 3ab85b481f4667f51bc5b701d80880c95acba185 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 14 Jan 2021 13:30:54 +0000 Subject: [PATCH] Bug 27427: (follow-up) Add validation trigger to datepicker This patch adds a default action to the datepicker plugin, triggering an "onSelect" event which checks to see if the field is valid according to the jQuery validation plugin. This change attempts to fix a problem where validation isn't triggered by the typical onkeyup or blur events because the field is updated by the datepicker plugin. --- koha-tmpl/intranet-tmpl/prog/js/calendar.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js b/koha-tmpl/intranet-tmpl/prog/js/calendar.js index 1f312e813d..41e6dd4e9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js +++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js @@ -127,6 +127,11 @@ jQuery(function ($) { yearSuffix: '' }; $.datepicker.setDefaults($.datepicker.regional['']); + $.datepicker.setDefaults({ + onSelect: function () { + $(this).valid(); + } + }); }); /* jQuery Validator plugin custom method -- 2.11.0