我刚刚开始使用lift,我现在正试图将普通表单更改为ajax 表单,但processEntryAdd
从未调用过该方法。
def addUser(xhtml : Group) : NodeSeq = {
var firstName = ""
var lastName = ""
def processEntryAdd() {
Log.info("processEntryAdd: " + firstName + ", " + lastName)
}
SHtml.ajaxForm(
bind("entry", xhtml,
"firstName" -> SHtml.text(firstName,
(x) => {
Log.info("Setting firstName to " + x);
firstName = x
}),
"lastName" -> SHtml.text(lastName,
(x) => {
Log.info("Setting lastName to " + x);
lastName = x
}),
"submit" -> SHtml.submit("Add user", processEntryAdd),
))
}
知道如何实现我想要做的事情,或者为什么上面的代码不起作用。按下按钮时会提交两个表单字段的值,并且设置了两个局部变量firstName
和lastName
,但不调用与 SHtml.submit 关联的函数。
谢谢!