Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play framework form validation in scala

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)
)
like image 795
boycod3 Avatar asked Nov 30 '25 00:11

boycod3


1 Answers

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

your missing the ("Passwords must match", f => f.password1 == f.password2)