如何在游戏中验证另一个表单输入



这是我基于示例的代码:

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...或第三次检查...

在哪里可以添加另一个"验证"位?

谢谢

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 (...)
)

最新更新