TextBox, TextArea: Message max length validation (close #20710) (#20886)

* fix bug max length messsage

* change localization

---------

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>
This commit is contained in:
NguyenThuyLan
2025-11-19 20:24:32 +07:00
committed by GitHub
parent e2a8bea579
commit 386611bc70
2 changed files with 8 additions and 0 deletions

View File

@@ -88,6 +88,10 @@ export class UmbPropertyEditorUITextBoxElement
@input=${this.#onInput} @input=${this.#onInput}
?required=${this.mandatory} ?required=${this.mandatory}
.requiredMessage=${this.mandatoryMessage} .requiredMessage=${this.mandatoryMessage}
.maxlengthMessage=${() => {
const exceeded = (this.value?.length ?? 0) - (this._maxChars ?? 0);
return this.localize.term('textbox_characters_exceed', this._maxChars, exceeded);
}}
?readonly=${this.readonly}></uui-input>`; ?readonly=${this.readonly}></uui-input>`;
} }

View File

@@ -90,6 +90,10 @@ export class UmbPropertyEditorUITextareaElement
@input=${this.#onInput} @input=${this.#onInput}
?required=${this.mandatory} ?required=${this.mandatory}
.requiredMessage=${this.mandatoryMessage} .requiredMessage=${this.mandatoryMessage}
.maxlengthMessage=${() => {
const exceeded = (this.value?.length ?? 0) - (this._maxChars ?? 0);
return this.localize.term('textbox_characters_exceed', this._maxChars, exceeded);
}}
?readonly=${this.readonly}></uui-textarea> ?readonly=${this.readonly}></uui-textarea>
`; `;
} }