From: Coleman Watts Date: Tue, 10 Mar 2015 19:41:11 +0000 (-0400) Subject: CRM-16019 - Reset mode if user entered an invalid date X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=81b0c82f8e27e2cd73fce678554d31fc00588e7b;p=civicrm-core.git CRM-16019 - Reset mode if user entered an invalid date --- diff --git a/js/angular-crmMailing/directives.js b/js/angular-crmMailing/directives.js index a9977a6a9f..307df6369e 100644 --- a/js/angular-crmMailing/directives.js +++ b/js/angular-crmMailing/directives.js @@ -148,9 +148,18 @@ } }); - element.on('click', ':radio[value=at]', function() { - $('.crm-form-date', element).focus(); - }); + element + // Open datepicker when clicking "At" radio + .on('click', ':radio[value=at]', function() { + $('.crm-form-date', element).focus(); + }) + // Reset mode if user entered an invalid date + .on('change', '.crm-hidden-date', function(e, context) { + if (context === 'userInput' && $(this).val() === '' && $(this).siblings('.crm-form-date').val().length) { + schedule.mode = 'at'; + schedule.datetime = '?'; + } + }); $scope.$watch(attrs.crmMailingRadioDate + '.mode', updateParent); $scope.$watch(attrs.crmMailingRadioDate + '.datetime', function (newValue, oldValue) {