Form processing is coming along good

0 views
Skip to first unread message

thebug...@gmail.com

unread,
Jul 11, 2008, 8:55:21 AM7/11/08
to SweetScala
So I added the code in last night, the end result usage is like this:

class UserController extends FormController{
handleForm("/new-form", "user"){
form => form.req.method match {
case Get => HandlerNameView()
case Post => handleNewForm(form)
}
}

def handleNewForm(form: Form): View = {
val req = form.req
for(n <- form.fieldNames)
logger.debug("Form "+n+ " value="+form(n))

View("/profile")
}
}

I did some refactoring of Req and Resp class that the latest trunk
won't compatible with preview SNAPSHOT.4 release. But I doubt anyone
is using it right now :-P

I need to add more sample cases into the sample-basic app for form
handling.

Have fun!
-Z
Reply all
Reply to author
Forward
0 new messages