Answer the question
In order to leave comments, you need to log in
Play Framework comes form, how to process it correctly?
I receive a form like this:
Form([email protected],Map(action -> user_auth, args[accountName] -> Login, args[code] -> code123, secret_key -> secret_key111)..
I need to correctly extract the values of args.accountName and args.code
I created the following case classes:
case class Args(accountName: String, code: String)
case class MyClass(action: String, args: Args, secret_key: String)
object MyClassForm {
val form = Form(mapping(
"action" -> nonEmptyText,
"args" -> mapping(
"accountName" -> nonEmptyText,
"code" -> nonEmptyText
)(Args.apply)(Args.unapply),
"secret_key" -> nonEmptyText
)(MyClass.apply)(MyClass.unapply)
)
}
Answer the question
In order to leave comments, you need to log in
According to the Play Framework documentation,
Note: When you are using nested data this way, the form values sent by the browser must be named like address.street, address.city, etc.( link )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question