I have the following form:
<form class="lift:form.ajax">
<div class="lift:StreamInput">
<input type="hidden" name="path" value="test" />
<input type="hidden" name="user" value="james" />
<input type="hidden" name="level" value="_1" />
<input type="hidden" name="room" value="demo" />
<input type="hidden" name="hidden" value="true" />
</div>
<input type="submit" value="" />
</form>
Which goes to:
object StreamInput {
def render = {
var path = ""
var user = ""
var level = ""
var room = ""
def process(): JsCmd = {
val message = comet.StreamItem(user, path, level, room)
StreamServer ! message
}
"name=path" #> SHtml.onSubmit(path = _) &
"name=user" #> SHtml.onSubmit(user = _) &
"name=level" #> SHtml.onSubmit(level = _) &
"name=room" #> SHtml.onSubmit(room = _) &
"name=hidden" #> SHtml.hidden(process)
}
}
However when I submit the form the values passed to the process method are empty. What am I missing that would cause them to be lost?
Thanks for any help in advance 🙂
I’m not able to test it right now but it could be that
SHtml.onSubmitdoes not work in an Ajax context. If you look at the documentation,SHtml.onSubmitis only used in the non-Ajax example. The Ajax examples useSHtml.textto bind a callback to the text input fields.