Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to capture 'enter key' press on TextView? #52

Closed
EliRibble opened this issue Jul 31, 2024 · 1 comment
Closed

How to capture 'enter key' press on TextView? #52

EliRibble opened this issue Jul 31, 2024 · 1 comment

Comments

@EliRibble
Copy link

I'm trying to add search capabilities to the jmap demo client that uses overture. I'd like far a user to be able to type a search term and press enter and have the search performed. I can't figure out from the documentation how to fire a function or capture the enter key press in Overture. Is there a way?

@neilj
Copy link
Member

neilj commented Aug 2, 2024

You can do this be adding an observer to the TextInputView:

new TextInputView({
    [... other config ...]
    submitOnEnter: function (event) {
        if (lookupKey(event) === 'Enter') {
            // Do something
        }
    }.on('keypress'),
}

@neilj neilj closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants