2013-05-06 41 views
0

我試圖檢索文本字段的值填充一個文本框的值,如波紋管顯示:檢票 - 獲得使用斯卡拉

item.add(new TextField("description", new Model[String]() { 
    override def getObject(): String = { 
     customer.description = ??? // I don't know how I can get the value here 
     return ... 
    } 
})) 

我有這個文本字段在ListView插入我需要使用TextField值將其設置在屬性模型中。

感謝

回答

1

首先,你需要一個新值發送到服務器,一個可能的解決方案是使用AjaxFormComponentUpdatingBehavior

val description = new TextField("description", new Model[String]) 
description.add(new AjaxFormComponentUpdatingBehavior("keyup") { 
    protected def onUpdate(target: AjaxRequestTarget) { 
    val newValue = description.getDefaultModelObjectAsString 
    } 
}) 

我還建議設置Throttling