I am just getting started with lift and I am now trying to change a normal form to an ajax form but the method processEntryAdd
is never called.
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),
))
}
Any idea how to achieve what I am trying to do, or why the code above doesn't work.
The values of the two form fields are submitted when the button is pressed and the two local variables firstName
and lastName
are set but the function associated with SHtml.submit isn't called.
Thanks!