2014-03-05 33 views
1

这是基于实例我的代码:我怎样才能获得另一个表单输入在游戏中验证?

val signupForm = Form(
    tuple(
     "firstname" -> nonEmptyText, 
     "lastname" -> nonEmptyText, 
     "email"  -> nonEmptyText, 
     "password1" -> nonEmptyText, 
     "password2" -> nonEmptyText, 
     "phone"  -> optional(text) 
    ) verifying ("That email address already exists please contact an administrator.", result => result match { 
     case (firstname, lastname, email, password1, password2, phone) => !User.checkexists(email).isDefined 
    }) 
    ) 

,但有证据显示,我怎么可能在里面添加其他检查没有例子 - 说比较密码1 &密码2 ...或第三检查...

我可以在哪里添加另一个“验证”位?

感谢

回答

2
val signupForm = Form(
    tuple(
    ... 
) verifying (...) 
    verifying (...) 
    verifying (...) 
) 

你的情况:

val signupForm = Form(
    tuple(
    "firstname" -> nonEmptyText, 
    "lastname" -> nonEmptyText, 
    "email"  -> nonEmptyText, 
    "password1" -> nonEmptyText, 
    "password2" -> nonEmptyText, 
    "phone"  -> optional(text) 
) verifying ("That email address already exists please contact an administrator.", result => result match { 
    case (firstname, lastname, email, password1, password2, phone) => !User.checkexists(email).isDefined 
    }) 
    verifying (...) 
) 
+0

十分感谢!!!!! – mbrambley