Auto focus on login text box
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
<RadzenText TextStyle="TextStyle.H5" TextAlign="TextAlign.Center">Вход</RadzenText>
|
||||
<RadzenFormField Text="Логин" Variant="Variant.Outlined">
|
||||
<ChildContent>
|
||||
<RadzenTextBox Name="UserName" @bind-Value=@Input.UserName AutoCompleteType="AutoCompleteType.Username" />
|
||||
<RadzenTextBox @ref="@userNameTextBox" Name="UserName" @bind-Value=@Input.UserName AutoCompleteType="AutoCompleteType.Username" />
|
||||
</ChildContent>
|
||||
<Helper>
|
||||
<RadzenRequiredValidator Component="UserName" Text="Поле 'Логин' обязательно к заполнению" />
|
||||
@ -41,6 +41,8 @@
|
||||
public string Password { get; set; } = "";
|
||||
}
|
||||
|
||||
RadzenTextBox userNameTextBox;
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
InputModel Input { get; set; } = new();
|
||||
|
||||
@ -52,8 +54,6 @@
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
base.OnAfterRender(firstRender);
|
||||
|
||||
if (firstRender)
|
||||
{
|
||||
if (Status == "failed")
|
||||
@ -66,6 +66,8 @@
|
||||
Duration = -1d
|
||||
});
|
||||
}
|
||||
|
||||
userNameTextBox.Element.FocusAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user