Form fields should not init in the error state (#17615)

This commit is contained in:
Simon Lamon 2023-08-21 15:49:27 +02:00 committed by GitHub
parent e764076b1a
commit bfcdbbd70b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 17 deletions

View File

@ -176,7 +176,7 @@ class DialogCalendarEventEditor extends LitElement {
.value=${this._summary}
required
@change=${this._handleSummaryChanged}
error-message=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
dialogInitialFocus
></ha-textfield>
<ha-textarea

View File

@ -191,7 +191,7 @@ export class DialogAddApplicationCredential extends LitElement {
.value=${this._name}
required
@input=${this._handleValueChanged}
error-message=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
dialogInitialFocus
></ha-textfield>
<ha-textfield
@ -203,7 +203,7 @@ export class DialogAddApplicationCredential extends LitElement {
.value=${this._clientId}
required
@input=${this._handleValueChanged}
error-message=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
dialogInitialFocus
.helper=${this.hass.localize(
"ui.panel.config.application_credentials.editor.client_id_helper"
@ -219,7 +219,7 @@ export class DialogAddApplicationCredential extends LitElement {
.value=${this._clientSecret}
required
@input=${this._handleValueChanged}
error-message=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
.helper=${this.hass.localize(
"ui.panel.config.application_credentials.editor.client_secret_helper"
)}

View File

@ -93,10 +93,10 @@ class DialogAreaDetail extends LitElement {
.value=${this._name}
@input=${this._nameChanged}
.label=${this.hass.localize("ui.panel.config.areas.editor.name")}
.errorMessage=${this.hass.localize(
.validationMessage=${this.hass.localize(
"ui.panel.config.areas.editor.name_required"
)}
.invalid=${nameInvalid}
required
dialogInitialFocus
></ha-textfield>

View File

@ -516,7 +516,7 @@ export class EntityRegistrySettingsEditor extends LitElement {
${domain === "lock"
? html`
<ha-textfield
.errorMessage=${this.hass.localize(
.validationMessage=${this.hass.localize(
"ui.dialogs.entity_registry.editor.default_code_error"
)}
.value=${this._defaultCode == null ? "" : this._defaultCode}

View File

@ -121,11 +121,10 @@ class DialogPersonDetail extends LitElement {
.value=${this._name}
@input=${this._nameChanged}
label=${this.hass!.localize("ui.panel.config.person.detail.name")}
error-message=${this.hass!.localize(
.validationMessage=${this.hass!.localize(
"ui.panel.config.person.detail.name_error_msg"
)}
required
auto-validate
></ha-textfield>
<ha-picture-upload
.hass=${this.hass}

View File

@ -95,11 +95,10 @@ class DialogTagDetail
.configValue=${"name"}
@input=${this._valueChanged}
.label=${this.hass!.localize("ui.panel.config.tag.detail.name")}
.errorMessage=${this.hass!.localize(
.validationMessage=${this.hass!.localize(
"ui.panel.config.tag.detail.required_error_msg"
)}
required
auto-validate
></ha-textfield>
${!this._params.entry
? html`<ha-textfield
@ -154,7 +153,7 @@ class DialogTagDetail
<mwc-button
slot="primaryAction"
@click=${this._updateEntry}
.disabled=${this._submitting}
.disabled=${this._submitting || !this._name}
>
${this._params.entry
? this.hass!.localize("ui.panel.config.tag.detail.update")
@ -164,7 +163,7 @@ class DialogTagDetail
? html` <mwc-button
slot="primaryAction"
@click=${this._updateWriteEntry}
.disabled=${this._submitting}
.disabled=${this._submitting || !this._name}
>
${this.hass!.localize(
"ui.panel.config.tag.detail.create_and_write"
@ -271,6 +270,10 @@ class DialogTagDetail
#qr {
text-align: center;
}
ha-textfield {
display: block;
margin: 8px 0;
}
`,
];
}

View File

@ -107,7 +107,9 @@ export class DialogAddUser extends LitElement {
)}
.value=${this._name}
required
.errorMessage=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize(
"ui.common.error_required"
)}
@input=${this._handleValueChanged}
@blur=${this._maybePopulateUsername}
dialogInitialFocus
@ -122,7 +124,7 @@ export class DialogAddUser extends LitElement {
.value=${this._username}
required
@input=${this._handleValueChanged}
.errorMessage=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
dialogInitialFocus
></ha-textfield>
@ -135,7 +137,7 @@ export class DialogAddUser extends LitElement {
.value=${this._password}
required
@input=${this._handleValueChanged}
.errorMessage=${this.hass.localize("ui.common.error_required")}
.validationMessage=${this.hass.localize("ui.common.error_required")}
></ha-textfield>
<ha-textfield
@ -150,7 +152,7 @@ export class DialogAddUser extends LitElement {
.invalid=${this._password !== "" &&
this._passwordConfirm !== "" &&
this._passwordConfirm !== this._password}
.errorMessage=${this.hass.localize(
.validationMessage=${this.hass.localize(
"ui.panel.config.users.add_user.password_not_match"
)}
></ha-textfield>