2014-01-14 51 views
0

我是smart gwt框架的新手。我的問題是,當我使用ItemFields時,沒有辦法從該特定itemField獲取文本。我的目標是填充firstNameItemField,獲取文本並將其發送到我實施的服務。如何從項目字段獲取文本(字符串)

如何從該ItemField獲取字符串? 這是怎麼回事,沒有getText方法?

例如

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

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

您是否試過['getEnteredValue()'](http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/TextItem.html#getEnteredValue())或[ 'getValue'](http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/FormItem.html#getValue())? – thegrinner

回答

0

這應該爲你工作:

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

因此,代碼是:

String name = firstName.getValueAsString(); 
0

Doc你可以用下面的代碼:

String name = firstName.getEnteredValue() 
相關問題