【发布时间】:2014-04-11 09:39:03
【问题描述】:
我正在尝试将案例类应用于 Scala Play 表单中的单个字段。我尝试将其应用到的字段是 exerciseName 在 setsForm 变量内。
case class ExerciseName(exerciseName:String)
case class WorkoutSet(exerciseName:ExerciseName, number:Int)
case class WorkoutSets(sets:List[WorkoutSet])
val setsForm:Form[WorkoutSets] = Form(
mapping(
"workoutSets" -> list(mapping
(
//i need to get exerciseName to be of type ExerciseName somehow...
"exerciseName" ->nonEmptyText,
"workoutSet" -> number(min=1,max=20)
)(WorkoutSet.apply)(WorkoutSet.unapply))
)(WorkoutSets.apply)(WorkoutSets.unapply)
)
我想知道是否有人可以就此提供任何见解。
谢谢!
【问题讨论】:
标签: scala playframework playframework-2.0