在Scala中播放框架表单验证 [英] play framework form validation in scala
本文介绍了在Scala中播放框架表单验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Scala中进行游戏框架表单验证的工作 跟随我的Signup对象,它在行"mapping(":"missing 对象形式中用于方法映射的参数;按照此方法使用"_"如果你想 将其视为部分应用的功能"
Working of play framework form validation in scala follows my Signup object, it gives me an error at the line "mapping(": "missing arguments for method mapping in object Forms; follow this method with `_' if you want to treat it as a partially applied function"
case class UserRegistration(username: String, password1: String, password2: String)
val loginForm = Form(
mapping(
"username" -> email,
"password1" -> text,
"password2" -> text
)
(UserRegistration.apply)(UserRegistration.unapply)
verifying ("Passwords must match", => f.password1 == f.password2)
)
推荐答案
case class UserRegistration(username: String, password1: String, password2: String)
val loginForm = Form(
mapping(
"username" -> email,
"password1" -> text,
"password2" -> text
)
(UserRegistration.apply)(UserRegistration.unapply)
verifying ("Passwords must match", f => f.password1 == f.password2)
)
您丢失了("Passwords must match", f => f.password1 == f.password2)
这篇关于在Scala中播放框架表单验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文