What happens if someone presses Enter

On the default login layout, if you press enter, you login. It would be lovely, if we could do the same for any text box as an event,right now we can only use change events on the default textbox and area, it would be great if we could set it so whenever someone presses enter to confirm we could run something.

In my case, using custom login layouts and making a small search engine inside radzen, it would be a great little feature to be able to allow people to search by just pressing enter.

1 Like

Indeed we can expose some key related events for the input components. Logging this as a feature request.

So is there any way I can use a javascript code to emulate this behaviour?

I tried to put inside a html component but got no success. Is there any way to do this in radzen?:

    function handle(e){
        if(e.keyCode === 13){
            e.preventDefault(); // Ensure it is only this code that rusn
            var site = "http://dataja.com.br"
            var destino = "pesquisa-resultados";
            var parametro = "";
            parametro = document.getElementById('search10').value;
            var pagina = "1";
            var destinofinal = destino + "/" + parametro + "/" + pagina;
            var a = new URL(destinofinal,site);

Check this thread. Replace (click) with (keypress) or (keyup) and use onKeyUp($event) as a value.

I was looking for the same today. works with core 3.0 and higher

<RadzenTextBox @onkeypress="@(e => ShellConsoleInputKeyPressed(e))"></RadzenTextBox>

protected async Task ShellConsoleInputKeyPressed(KeyboardEventArgs args)
            if (args.Key == "Enter")
                //call login or what ever you want when user pressed Enter
1 Like

I've been trying to implement this same feature in my app. But... it seems that the databound textboxes don't update the variable to which they are bound, until the field loses focus. Is this typical?