Pergunta

I am new to the smart gwt framework. My problem is, when I am working with ItemFields, there is no way how to get text from that particlar itemField. My goal is to fill the firstName ItemField, grab the text, and send it to the service, that I implemented.

How can I get string from that ItemField? How is that, that there is no getText Method?

for example

final TextItem firstName = new TextItem("firstName", "First name");
*******************************************************************

public void onClick(ClickEvent event) {
    String name = firstName.????????;
    contactForm.greetings(name, new CallbackHandler());
}
});
Foi útil?

Solução

This should work for you:

getValueAsString()
  Return the value tracked by this form item.

So the code would be:

String name = firstName.getValueAsString();

Outras dicas

From Doc you can use following code:

String name = firstName.getEnteredValue()
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top