Frage

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());
}
});
War es hilfreich?

Lösung

This should work for you:

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

So the code would be:

String name = firstName.getValueAsString();

Andere Tipps

From Doc you can use following code:

String name = firstName.getEnteredValue()
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top