Trigger an action with the "enter" key?
Application Type
Reactive

Hi! :)

I am developing a login page and I want to call a screen action when the user presses the "enter" key?
Is there a way to do this?



Thank you,

Daniela


mvp_badge
MVP
Solution

Hello there Daniela,

Hope you're doing well.


You should be able to achieve that using JavaScript. Please consider the following code:

document.addEventListener('keypress', function enterPress(e){
    if(e.which == 13) {
        $actions.YourScreenAction();
    }
});

where YourScreenAction is the screen action that you want to execute when you press "enter".


You should put this JavaScript in your OnReady event.


Hope that this helps you!


Kind regards,

Rui Barradas

mvp_badge
MVP

Hi,

lthough the solution of Rui is a correct answer, from an user experience perspective and low-code perspective you should consider to link the action to a button on your screen and set the Is Form Default property of that button to yes.

In the case of a Login screen, there should be a Login Button that you can use to set the Is Form Default property.

No Javascript needed, that requires extra testing.

Regards,

Daniel

mvp_badge
MVP

Hello there Daniël,

Since the thread refers to "developing a login page", I indeed assumed that we're talking about a customized new login page.

Also, there is no reference to a Button. The only presented information is that it is pretended to call a screen action by pressing the "enter" key.


I understand your point of view, but it requires to have a Form and a Button and I wasn't sure if those requirements were met in here. The only given information is that she wanted to trigger an action by pressing "enter". That's why I suggested this way :)


Kind regards,

Rui Barradas

Champion

HI Daniela Henriques

Sorry if I misunderstanding your issue.

The default login screen already has the function you required.

When you press the Enter key it triggers the login action.

Kindly Regards

HI Daniela Henriques 

 Please find the attachment.

There is "Is Form Default " property of the button by making it true you can call screen action when press "enter" Key


Hope that this helps you! 

Regards,

Arun Rajput

Capture.PNG

Thank you arun

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