Skip to content

Commit d183a2d

Browse files
nielslyngsoegitbook-bot
authored andcommitted
GITBOOK-28: Append information about Integrating inner elements of Property Editors
1 parent e5ee439 commit d183a2d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

16/umbraco-cms/customizing/property-editors/property-editor-validation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ declare global {
3838

3939
```
4040

41+
### Add Validation rules
42+
4143
Once your Property Editor is a Form Control, you can append validation rules to it.
4244

4345
```typescript
@@ -78,3 +80,24 @@ Notice that `value` is already defined in the FormControlMixin, and ideally, you
7880
return super.value;
7981
}
8082
```
83+
84+
### Integrate the validation of an inner element
85+
86+
You may have inner elements that are `FormControls` and should affect the validity of your property editor.\
87+
In this case, bind the inner element to the property editor.
88+
89+
The following example shows how to make a local `uui-input` part of the property editor’s validation.
90+
91+
```typescript
92+
...
93+
94+
protected override firstUpdated() {
95+
this.addFormControlElement(this.shadowRoot!.querySelector('uui-input')!);
96+
}
97+
98+
...
99+
```
100+
101+
{% hint style="info" %}
102+
This example requires your property editor to be built with Lit. If you are not using Lit, you need another way to detect when the element is in the DOM or to create it virtually.
103+
{% endhint %}

0 commit comments

Comments
 (0)