문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top