From bc7afe4bdd23ca4a74afaf04d1afc30731cc4200 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 9 Aug 2018 17:25:27 +0200 Subject: [PATCH] Auto "click" the shortcut checkbox when manually entering the shortcut date (references #40) --- public/viewjs/components/datetimepicker.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/viewjs/components/datetimepicker.js b/public/viewjs/components/datetimepicker.js index cccb007f..1d7bc286 100644 --- a/public/viewjs/components/datetimepicker.js +++ b/public/viewjs/components/datetimepicker.js @@ -159,6 +159,14 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e) element.setCustomValidity(""); } } + + // "Click" the shortcut checkbox when the shortcut value was + // entered manually and it is currently not set + var shortcutValue = $("#datetimepicker-shortcut").data("datetimepicker-shortcut-value"); + if (value == shortcutValue && !$("#datetimepicker-shortcut").is(":checked")) + { + $("#datetimepicker-shortcut").click(); + } }); Grocy.Components.DateTimePicker.GetInputElement().on('input', function(e)