From 65750d2b32ac4376bd9458785f20caba1a9aed67 Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Thu, 20 Feb 2020 08:59:46 +1000 Subject: [PATCH] fixes regression where validation object doesn't always exist on the property, depending on context --- .../directives/validation/valpropertymsg.directive.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js index 5b0c4c11aeaf..149c2b50878e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js @@ -39,7 +39,9 @@ function valPropertyMsg(serverValidationManager, localizationService) { scope.currentProperty = currentProperty; var currentCulture = currentProperty.culture; - var isMandatory = currentProperty.validation.mandatory; + + // validation object won't exist when editor loads outside the content form (ie in settings section when modifying a content type) + var isMandatory = currentProperty.validation ? currentProperty.validation.mandatory : undefined; var labels = {}; localizationService.localize("errors_propertyHasErrors").then(function (data) { @@ -141,7 +143,7 @@ function valPropertyMsg(serverValidationManager, localizationService) { else if (_.without(_.keys(formCtrl.$error), "valPropertyMsg").length > 0) { // errors exist, but if the property is NOT mandatory and has no value, the errors should be cleared - if (!isMandatory && !currentProperty.value) { + if (isMandatory !== undefined && isMandatory === false && !currentProperty.value) { hasError = false; showValidation = false; scope.errorMsg = "";