Add handler for OnKeyUp( enter ) on form/page
See original GitHub issueHi Chris,
Thanks for the control - it’s great! 😃
I have an input where I’m tying in an event to the Enter key, so that somebody can type in a string, and when they hit enter it’ll trigger an action to update the underlying object. So I have:
<input
@bind-value=“NewTag” @bind-value:event=“oninput” @onkeyup=“ProcessEnterKey” >
private void ProcessEnterKey( KeyboardEventArgs eventArgs)
{
if (eventArgs.Key == "Enter" ) // fire on enter
SaveTheData();
}
Unfortunately, if I try and use this with the BlazoredTypeAhead like this:
<BlazoredTypeahead SearchMethod="SearchTags" @bind-Value="NewTag" @onkeyup="ProcessEnteEnterr">
it breaks the Typeahead control - I think because it replaces your control’s internal onkeyup Handler. I’m relatively new to Blazor - is there a way to have both handlers in place, or is there a trivial way to extend the Typeahead keyup handler? I was going to derive a custom class using the BlazoredTypeAhead as the base, and then override the OnKeyUp method to extend it, but to do this, your KeyUp handler would need to be virtual. Is there a better, or more idiomatic way to do this in Blazor?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Haha - sure. I was likely to get to this in about 6-8 weeks, if I’m lucky, so no risk of doing anything which will interfere with the work you’re doing on that issue. 😃
I’m going to close this issue in favor of the existing one, if that’s ok with you @Webreaper? If you feel anything is not being covered please re-open.