Hi all,
I've been looking for info on MappedNullableLong but there's nothing much on the net and the class docs are insufficient for what I'm looking for.
I am using CRUDify. If I add a MappedNullableLong field, when displaying it it shows as either "Empty" or "Full(x)" (where x is the value), and the same thing shows in the text field in the input form. What I'd like is for an empty field/text to signify Empty, and just the value to signify Full(value).
Here's what I've done:
trait NiceNullableLong[T <: Mapper[T]] {
self: MappedNullableLong[T] =>
override def toString = is.openOr("").toString
override def toForm = Full(SHtml.text(toString,
x => if (x.length == 0) set(Empty) else set(Full(Integer.parseInt(x)))))
}
And then I define the field as:
object maxMinutes extends MappedNullableLong(this) with NiceNullableLong[User]
This seems to take care of displaying the field, but when I edit a record I still get the Empty/Full(x) value (although entering just an Integer actually works correctly)
Any ideas?
Thanks!
-Mario.
--
I want to change the world but they won't give me the source code.