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,

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

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

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. 

Solution

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

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

Solution