question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextField value not available in KeyUp listener

See original GitHub issue
textField.addKeyUpListener("Enter", e -> {
    System.out.println("Committed "+textField.getValue());
});

Expected result after typing 123 and pressing enter: “Committed 123”

Actual result: "Committed "

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
heruancommented, May 6, 2018

Note that pressing <kbd>ENTER</kbd> will fire a change event, but the input won’t blur.

That said, I don’t totally agree considering this an anti-pattern: pressing the <kbd>ENTER</kbd> key is a common user action to confirm their input, as in “I’m done, let’s go ahead” (in HTML native forms, pressing <kbd>ENTER</kbd> will fire a submit event and trigger a GET/POST request, as a shortcut of pressing the submit button). This can’t be related to a change event of single input fields, which will fire whenever an input blurs.

In Flow, if the developer wants to mimic this behavior of native form at the moment needs to explicitly add a keyup listener for <kbd>ENTER</kbd> to all related inputs: it would be useful to be able to attach the listener to the Binder, or the FormLayout or the generic container component of the form fields.

0reactions
plekucommented, May 9, 2018

it would be useful to be able to attach the listener to the Binder, or the FormLayout or the generic container component of the form fields.

I agree with this, but that is another enhancement issue to make. KeyUpListener is not at the moment really meant for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

input value not responding to "keyup" event - Stack Overflow
I am having problem with the following code. It is a simple To Do app with Javascript. Following a tutorial, followed to the...
Read more >
Element: keyup event - Web APIs | MDN
Returns a string with the code value of the physical key represented by the event. Warning: This ignores the user's keyboard layout, so...
Read more >
Javascript Keydown & Keyup Event to Get Value ... - YouTube
Javascript Keydown & Keyup Event to Get Value on Keypress in Textbox Example in Browser [LIVE CODE]. Watch later. Share. Copy link.
Read more >
.keypress() | jQuery API Documentation
Description: Bind an event handler to the "keypress" JavaScript event, or trigger that event on an ... <input id="target" type="text" value="Hello there">.
Read more >
I can't catch the JavaScript keyup event of the Input element ...
The browser's console window should be showing you errors for these. ... In this case, the program does not enter in the keyup...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found