diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js index e15f62e8df..104736530f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js @@ -10,12 +10,12 @@ function noDirtyCheck() { require: 'ngModel', link: function (scope, elm, attrs, ctrl) { - elm.focus(function () { - scope.$watch(function() { - ctrl.$pristine = false; - }); - }); - + var alwaysFalse = { + get: function () { return false; }, + set: function () { } + }; + Object.defineProperty(ctrl, '$pristine', alwaysFalse); + Object.defineProperty(ctrl, '$dirty', alwaysFalse); } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js index 3c8170e54b..d8a7710bbb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js @@ -130,6 +130,9 @@ function fileUploadController($scope, $element, $compile, imageHelper, fileManag // in the description of this controller, it states that this value isn't actually used for persistence, // but we need to set it so that the editor and the server can detect that it's been changed, and it is used for validation. $scope.model.value = { selectedFiles: newVal.trimEnd(",") }; + + //need to explicity setDirty here as file upload field can't track dirty & we can't use the fileCount (hidden field/model) + $scope.propertyForm.$setDirty(); }); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html index 0905de07f9..63810ac610 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html @@ -31,6 +31,6 @@ - +