I can't figure out how to properly override toForm
(or is it _toForm
?) in MappedField
.
Specifically I'd like my
object pro开发者_Python百科videsInternship extends MappedBoolean(this) {
override def displayName = "Provides Internship"
override def asHtml = Text(if (is) "Yes" else "No")
override def dbNotNull_? = true
}
to be rendered (through the toForm
call) as
<input type="radio" name=... value=... /> Yes
<input type="radio" name=... value=... /> No
I've Googled, read the ScalaDocs and the source code for MappedField
to no avail.
Any hints or pointers to tutorial-like documentation are welcome!
I have not done this for MappedXXX but for fields in a LiftScreen to make them readonly, not sure if the same thing works for you.
val input4 = new Field {
type ValueType = String
override def name = "Not Editable"
override def default = "Cannot change"
lazy val manifest = buildIt[ValueType]
override def toForm: Box[NodeSeq] =
SHtml.text(is, set _, "readonly" -> "readonly")
}
精彩评论