Skip to content

Commit bae0c27

Browse files
committed
user workspace validation context
1 parent 47359b5 commit bae0c27

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/packages/core/validation/controllers/validation.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
219219
/**
220220
* Validate this context, all the validators of this context will be validated.
221221
* Notice its a recursive check meaning sub validation contexts also validates their validators.
222-
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validator succeeded, this depends on the validators and wether forceSucceed is set.
222+
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validation succeeded.
223223
*/
224224
async validate(): Promise<void> {
225225
// TODO: clear server messages here?, well maybe only if we know we will get new server messages? Do the server messages hook into the system like another validator?

src/packages/user/user/workspace/user/components/user-workspace-profile-settings/user-workspace-profile-settings.element.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
66
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
77
import type { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
88
import type { UmbUiCultureInputElement } from '@umbraco-cms/backoffice/localization';
9+
import { umbBindToValidation } from '@umbraco-cms/backoffice/validation';
910

1011
@customElement('umb-user-workspace-profile-settings')
1112
export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
@@ -79,6 +80,7 @@ export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
7980
@change="${this.#onEmailChange}"
8081
required
8182
required-message=${this.localize.term('user_emailRequired')}
83+
${umbBindToValidation(this)}
8284
value=${ifDefined(this._user?.email)}></uui-input>
8385
</umb-property-layout>
8486
`;

src/packages/user/user/workspace/user/user-workspace.context.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/wor
99
import { UmbSubmittableWorkspaceContextBase } from '@umbraco-cms/backoffice/workspace';
1010
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1111
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
12+
import { UmbValidationContext } from '@umbraco-cms/backoffice/validation';
1213

1314
type EntityType = UmbUserDetailModel;
1415

@@ -40,6 +41,8 @@ export class UmbUserWorkspaceContext
4041
constructor(host: UmbControllerHost) {
4142
super(host, UMB_USER_WORKSPACE_ALIAS);
4243

44+
this.addValidationContext(new UmbValidationContext(this));
45+
4346
this.routes.setRoutes([
4447
{
4548
path: 'edit/:id',

0 commit comments

Comments
 (0)