I try to define defaul value for scala template parameter, like:
@(user: Form[User] = Form[User])
And I see compilation error:
object play.data.Form is not a value
whats wrong?
Unfortunately it doesnt work like this, you have to define the Form's presentation. You may have in your User class:
val requestForm = Form(
mapping("field1" -> nonEmptyText,
"field2" -> nonEmptyText)(User.apply)(User.unapply))
And then you can use your template like this:
@(user: Form[User] = User.requestForm)
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.