Question

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());
}
});
Was it helpful?

Solution

This should work for you:

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

So the code would be:

String name = firstName.getValueAsString();

OTHER TIPS

From Doc you can use following code:

String name = firstName.getEnteredValue()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top