I want to navigate between fields of Editform with Enter Key thats means i want Enter Key act as Tab key using c# code in blazor,
I use this code but it does not work
<EditForm Model="@productDtoVM" OnValidSubmit="Save">
<InputText @bind-Value="productDtoVM.itmNo" class="form-control"@onkpress="Tab"/>
</EditForm>
this is Tab method
void Tab(KeyboardEventArgs e)
{
if (e.Key == "Enter")
{
e.Key = "Tab";
}
}
i tried to use @onkeyup and @onkeydown instead of @onkeypress but they not working
2
Answers
"I tried to use @onkeyup and @onkeydown instead of @onkeypress but they not working"
Edit Form:
C# Code:
}
JavaScript Code On wwwroot
:Output:
Hope above steps guided you accordingly.
You can achieve this functionality with this setup, you can use tabIndex to find next control to move to with enter key press
This is javascript function which moves focus to next control
Let me know your thoughts on it