I have a set of model classes on the basis of a sealed trait like the following:
sealed trait Base {
def baseValue: String
}
case class ChildA(
baseValue: String
childAValue: Int
) extends Base
case class ChildB(
baseValue: String
childBValue: String
) extends Base
How do I handle the form submission properly, i.e. how can I define a Form that yields objects of type Base based on the given input data. I am expecting an extra field $type that holds the class type information for the specific subtype. Ideally, the form would also handle unknown types with a respective form error.
Aucun commentaire:
Enregistrer un commentaire