1867
Views
4
Comments
Solved
Reactive onkeyup enter key
Question

Hello!

Loving reactive but I have a challange, the onkeyup function works great but I want to filter on the key that is going up. Any idea how to do this in reactive?


Take care!

UserImage.jpg
freek
Solution

The event.keyCode is giving me no result but this works:

if(event.key == "Enter"){

2021-03-12 19-55-30
Greg Whitten
 
MVP

Hi freek,

In your onkeyup handler client action, a javascript block will automatically have access to the event object for the keyup, so you can simply access event.keyCode



In this example, when I keyup on 'a' I get an alert that says 65, keyup on 'enter' alerts 13, etc.


I hope that helps.


Greg

UserImage.jpg
Gonçalo Oliveira

Hello all,


The solution Greg gave will do what you need, just one thing, if i'm not mistaken it's best policy to use event.key instead of event.KeyCode, since different browsers can return different codes, but with event.key you get the correct char.


With the best regards,

Gonçalo

2020-01-08 12-23-57
Jitender Gaur

freek wrote:

Hello!

Loving reactive but I have a challange, the onkeyup function works great but I want to filter on the key that is going up. Any idea how to do this in reactive?


Take care!


Hi Freek, 

You can use same java script code as other technologies.  Just drag and drop JS action in you client active and same like Gonçalo shared the function Event.KeyCode return the current used key. 


So with above method you can filter Key in Java script function. 

UserImage.jpg
freek
Solution

The event.keyCode is giving me no result but this works:

if(event.key == "Enter"){

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.