문제

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());
}
});
도움이 되었습니까?

해결책

This should work for you:

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

So the code would be:

String name = firstName.getValueAsString();

다른 팁

From Doc you can use following code:

String name = firstName.getEnteredValue()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top