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.setValue doesn't change the value.

See original GitHub issue

Setting “” (empty string) on the lastName TextField in shortcut scope example doesn’t work. It works only when the focus is on the firstName TextField, and might work when playing around with focus.

public class Scope extends Div {
    public Scope() {
        TextField firstName = new TextField();
        TextField lastName = new TextField();

        add(firstName, lastName);

        Command command = () -> {
            firstName.setValue("");
            lastName.setValue("");
            firstName.focus();
        };
        // first parameter is the lifecycle owner of the shortcut and
        // will be discussed later.
        Shortcuts.addShortcutListener(this, command, Key.ESCAPE)
                // defines the component onto which the shortcuts listener
                // is attached:
                .listenOn(this);
    }
}

When fixing this improve also the documentation and also type and field naming in the example.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mstahvcommented, Mar 13, 2019

I pretty sure this is what happens:

  1. You type foo into an empty text field
  2. You hit the shortcut
  3. The server side instructs text field to be empty
  4. The server thinks it is smart and doesn’t send the empty value to the client as it thinks it is still empty. The foo remains in the text field.

Please don’t tell me it is a feature 🤓

0reactions
Legiothcommented, Jan 13, 2020

There’s a separate ticket for the assumed root cause. https://github.com/vaadin/flow/issues/7046.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material-UI TextField is not updating value when using ...
I'm trying to set new value that I'm getting from props and than update the TextField component with setValue of react-hook-form library.
Read more >
useForm - setValue - React Hook Form
This function allows you to dynamically set the value of a registered field and have the options to validate and update the form...
Read more >
setValue in the reactive form does not trigger change event in ...
Replication procedure: 1. Run the attached sample. 2. Open the browser console. 3. Change the value using up and down arrow keys ......
Read more >
API Documentation - Simple React forms validation
By using a custom register call, you will need to update the input value with setValue , because input is no longer registered...
Read more >
FormControl setvalue doesn't trigger valueChanges ... - Reddit
So I have a reactive form control which is passed as input to the child ... Updating the form control value doesn't change...
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