diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/bind-server-validation-to-form-control.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/bind-server-validation-to-form-control.controller.ts index 0c2593fd78..cb93af9066 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/bind-server-validation-to-form-control.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/bind-server-validation-to-form-control.controller.ts @@ -31,7 +31,7 @@ export class UmbBindServerValidationToFormControl extends UmbControllerBase { this.#value = value; // Only remove server validations from validation context [NL] const toRemove = this.#messages.filter((x) => x.type === 'server').map((msg) => msg.key); - this.#context?.messages.removeMessageByKeys(toRemove); + this.#context?.messages?.removeMessageByKeys(toRemove); } } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/form-control-validator.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/form-control-validator.controller.ts index 67bc5523ec..8a1e5282c9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/form-control-validator.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/form-control-validator.controller.ts @@ -30,7 +30,7 @@ export class UmbFormControlValidator extends UmbControllerBase implements UmbVal this.#context = context; context?.addValidator(this); // If we have a message already, then un-pristine the control: - if (dataPath && context?.messages.getHasMessagesOfPathAndDescendant(dataPath)) { + if (dataPath && context?.messages?.getHasMessagesOfPathAndDescendant(dataPath)) { formControl.pristine = false; } }); @@ -46,11 +46,11 @@ export class UmbFormControlValidator extends UmbControllerBase implements UmbVal if (this.#dataPath) { if (newVal) { - this.#context?.messages.removeMessagesByTypeAndPath('client', this.#dataPath); + this.#context?.messages?.removeMessagesByTypeAndPath('client', this.#dataPath); } else { // We only want to add the message if it is not already there. (this could be a custom or server message that got binded to the control, we do not want that double.) - if (!this.#context?.messages.getHasMessageOfPathAndBody(this.#dataPath, this.#control.validationMessage)) { - this.#context?.messages.addMessage('client', this.#dataPath, this.#control.validationMessage); + if (!this.#context?.messages?.getHasMessageOfPathAndBody(this.#dataPath, this.#control.validationMessage)) { + this.#context?.messages?.addMessage('client', this.#dataPath, this.#control.validationMessage); } } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/validation.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/validation.controller.ts index 821324469a..e57bd98a68 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/validation.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/validation/controllers/validation.controller.ts @@ -27,7 +27,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal >; #inUnprovidingState: boolean = false; - // @reprecated - Will be removed in v.17 + // @deprecated - Will be removed in v.17 // Local version of the data send to the server, only use-case is for translation. #translationData = new UmbObjectState(undefined); /** @@ -81,7 +81,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal setVariantId(variantId: UmbVariantId): void { this.#variantId = variantId; // @.culture == null && @.segment == null - this.messages.filter((msg) => { + this.messages?.filter((msg) => { // Figure out how many times '@.culture ==' is present in the path: //const cultureMatches = (msg.path.match(/@\.culture ==/g) || []); // I like a Regex that finds all the @.culture == and @.segment == in the path. they are adjacent. and I like to know the value following '== ' @@ -113,7 +113,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal * @param translator */ async addTranslator(translator: UmbValidationMessageTranslator) { - this.messages.addTranslator(translator); + this.messages?.addTranslator(translator); } /**