From 6004d7adaacd65d74510078d47f1e5b74f2f8a61 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 7 Jul 2020 13:03:54 +1000 Subject: [PATCH] seems to work with inline now --- .../validation/valpropertymsg.directive.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 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 30ba459baf..e44e36999a 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 @@ -157,15 +157,21 @@ function valPropertyMsg(serverValidationManager, localizationService, angularHel // where we have nested umb-property components. if (hadError) { scope.$evalAsync(function () { - if (valFormManager.isValid()) { - // TODO: I think we might have to use formCtrl.$$parentForm here since when using inline editing like - // nestedcontent style, there won't be a 'parent' valFormManager, or will there? i'm unsure - var parentValidationKey = umbPropCtrl.getParentValidationPath(); - if (parentValidationKey) { - var parentForm = formCtrl.$$parentForm; + + // we need to navigate the parentForm here, unfortunately there's no real alternative unless we create our own directive + // of some sort but that would also get messy. This works though since in this case we're always going to be in the property + // form and the parent form about this will contain any invalid flags for all the other sibling properties. So when that is + // no longer invalid, we can check if we have a parent validation key (meaning we'd be nested inside of umb-property) and + // we can clear that server error. + // TODO: If there is another server error for this property though this might clear it inadvertently, at this time I'm unsure how to deal with that. + var parentValidationKey = umbPropCtrl.getParentValidationPath(); + if (parentValidationKey) { + var parentForm = formCtrl.$$parentForm; + if (parentForm && !parentForm.$invalid) { serverValidationManager.removePropertyError(parentValidationKey, currentCulture, "", currentSegment); } } + });