made a change to \Umbraco\Js\umbraco.controllers.js:
function dateTimePickerController: added the currForm.$setDirty()
//handles the date changing via the api
function applyDate(e) {
// set form to dirty to tricker discard changes dialog
var currForm = angularHelper.getCurrentForm($scope);
currForm.$setDirty();
angularHelper.safeApply($scope, function () {
// when a date is changed, update the model
if (e.date && e.date.isValid()) {
$scope.datePickerForm.datepicker.$setValidity('pickerError', true);
$scope.hasDatetimePickerValue = true;
$scope.datetimePickerValue = e.date.format($scope.model.config.format);
} else {
$scope.hasDatetimePickerValue = false;
$scope.datetimePickerValue = null;
}
setModelValue();
if (!$scope.model.config.pickTime) {
$element.find('div:first').datetimepicker('hide', 0);
}
});
}
Added currForm.$setDirty()
$scope.clearDate = function () {
$scope.hasDatetimePickerValue = false;
$scope.datetimePickerValue = null;
$scope.model.value = null;
$scope.datePickerForm.datepicker.$setValidity('pickerError', true);
// set form to dirty to tricker discard changes dialog
var currForm = angularHelper.getCurrentForm($scope);
currForm.$setDirty();
};
Trigger $dirty Datepicker on "clear date" or change
I can't get my datepicker to go dirty on change or when it's cleared.
Is there a configuration I need to add to make $dirty work on the ng-form?
CONTROLLER:
VIEW:
made a change to \Umbraco\Js\umbraco.controllers.js:
function dateTimePickerController: added the currForm.$setDirty()
Added currForm.$setDirty()
is working on a reply...