MappedNullableLong with nicer input

9 views
Skip to first unread message

Mario Camou

unread,
Aug 22, 2011, 2:36:33 PM8/22/11
to lif...@googlegroups.com
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.

David Pollak

unread,
Aug 22, 2011, 2:50:29 PM8/22/11
to lif...@googlegroups.com
Please open a ticket (http://ticket.liftweb.net you must be a watcher of the LiftWeb space on Assembla to open tickets) and assign it to me for the 2.4-M4 milestone.  Please also reference this thread in the ticket.

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net

Mario Camou

unread,
Aug 22, 2011, 5:51:24 PM8/22/11
to lif...@googlegroups.com
Done, #1095. I don't see how to get a permalink to the issue itself, though.

Thanks!
-Mario.

--
I want to change the world but they won't give me the source code.


Reply all
Reply to author
Forward
0 new messages