web: set name on ak-form-element-horizontal for error messages

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-03-29 18:22:15 +02:00
parent 5b8e3b4189
commit d5281d2023
6 changed files with 92 additions and 37 deletions

View File

@ -30,10 +30,25 @@ export class HorizontalFormElement extends LitElement {
@property({ type: Boolean })
invalid = false;
@property()
name = "";
updated(): void {
this.querySelectorAll<HTMLInputElement>("input[autofocus]").forEach(input => {
input.focus();
});
this.querySelectorAll("*").forEach((input) => {
switch (input.tagName.toLowerCase()) {
case "input":
case "textarea":
case "select":
case "ak-codemirror":
(input as HTMLInputElement).name = this.name;
break;
default:
break;
}
});
}
render(): TemplateResult {