TextField and TextArea always return the empty String

Whenever I try to write something in the TextArea/Textfield, defocus it and press the button it returns a “” as the value on the function getValue(); I have tried to change the ValueChangeMode and it doesn’t work either.

public MainView() {
		Text texto = new Text("Add usuario");
		add(texto);
		TextArea nombre = new TextArea();
		nombre.setLabel("Name");
		TextArea apellido = new TextArea();
		apellido.setLabel("Optional");
		Button boton = new Button("Add");
		boton.addAttachListener(click -> {
			System.out.println("Name: " + nombre.getValue());
		});
		add(nombre);
		add(apellido);
		add(boton);
	}

That’s the code I wrote at first and always returns:

Vaadin is running in DEBUG MODE.
In order to run your application in production mode and disable debug features, you should enable it by setting the servlet init parameter productionMode to true.
See https://vaadin.com/docs/v14/flow/production/tutorial-production-mode-basic.html for more information about the production mode.
====================================================================
2019-11-26 14:35:38.257  INFO 13755 --- [nio-8080-exec-2]
 c.vaadin.flow.spring.SpringInstantiator  : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
Name: 
Name: 

Everything else works fine, the page is showing correctly.
Sorry for my english

You are calling

boton.addAttachListener(click -> {
            System.out.println("Name: " + nombre.getValue());
        });

which is probably not what you want. Instead, you want

boton.addClickListener(click -> { // ...

Olli Tietäväinen:
You are calling

boton.addAttachListener(click -> {
            System.out.println("Name: " + nombre.getValue());
        });

which is probably not what you want. Instead, you want

boton.addClickListener(click -> { // ...

That worked for me, thanks a lot