mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Prevent default form action (#3172)
This commit is contained in:
parent
cd5e274ffa
commit
89a35a0062
@ -130,7 +130,7 @@ class OnboardingCreateUser extends LitElement {
|
|||||||
);
|
);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.keyCode === 13) {
|
||||||
this._submitForm();
|
this._submitForm(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -152,7 +152,8 @@ class OnboardingCreateUser extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _submitForm(): Promise<void> {
|
private async _submitForm(ev): Promise<void> {
|
||||||
|
ev.preventDefault();
|
||||||
if (!this._name || !this._username || !this._password) {
|
if (!this._name || !this._username || !this._password) {
|
||||||
this._errorMsg = "required_fields";
|
this._errorMsg = "required_fields";
|
||||||
return;
|
return;
|
||||||
|
@ -108,7 +108,7 @@ class HaDialogAddUser extends LocalizeMixin(PolymerElement) {
|
|||||||
super.ready();
|
super.ready();
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.keyCode === 13) {
|
||||||
this._createUser();
|
this._createUser(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -131,7 +131,8 @@ class HaDialogAddUser extends LocalizeMixin(PolymerElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _createUser() {
|
async _createUser(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
if (!this._name || !this._username || !this._password) return;
|
if (!this._name || !this._username || !this._password) return;
|
||||||
|
|
||||||
this._loading = true;
|
this._loading = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user