Keyboard enter event

Hi.

My app provide a search function.
Users usually press enter button to search but when they press the button nothing happens.

So they have to click a search button on the screen for searching.

I worked hard to develop my app service but this one little issue make users think my app is not good enough.

It’s sad.

It would be great if pressing enter button on the keyboard trigger actions with input value.

Hi @Seong_Cho,

The input “onBlur” event fires when the user presses Enter, so you can use that one to run your search logic:

Thats interesting. I would have thought that would trigger an onFocus event.

Here’s when the different events fire:

Value of input changes → onChange
When you click into the input → onFocus
When the input loses focus because you clicked somewhere else or pressed Enter → onBlur

3 Likes

Thanks for this. However, how does one go about that? The blur event is only available inside the component and components don’t have access to app level data or page variables. Even open page doesn’t seem to work and I would need to pass the search query to through a page parameter. Thanks

if you are not using the primitive input component you need to add an event in the composite component,
i show how here

1 Like

@Brenton_Richards the Input field component has now been modified to expose the internal events by default. :slight_smile:

3 Likes

Great timing on that one! Haha.

Still find the whole thing a bit complex for what’s needed. But the update seems to have mitigated all this. Thanks for the help!

1 Like

yeah sure its better now, but keep this guide in mind because it works for triggering events n any composite component (those that you have to double click to open)

1 Like

For sure, I just need to play around with the event. Thanks again.

1 Like