MappedNullableLong doesn't display/edit correctly #1095

Closed
mcamou opened this Issue Aug 23, 2011 · 2 comments

Projects

None yet

3 participants

@mcamou
mcamou commented Aug 23, 2011

A MappedNullableLong field is not displayed correctly. Instead of showing just the number (if Full) or a blank (if Empty), it shows the toString of the Box (i.e., "Empty" or "Full(x)" where x is the contained value). Also, creating a trait with a toForm method and adding it to a MappedNullableLong field doesn't work. See https://groups.google.com/d/topic/liftweb/K0v_JkZjYMI/discussion.

Example code:

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)))))
}

object maxMinutes extends MappedNullableLong(this) with NiceNullableLong[User]


@dpp
Member
dpp commented Aug 25, 2011

(In [[r:d2d60dfe29712d9155e6c4e00fb0179426a7fe19]]) Closes #938. Closes #1095. Better support to asJsExp in foreign key references. Better handling of Nullable fields in forms and display

Branch: master

@dpp dpp was assigned Mar 1, 2012
@etorreborre etorreborre pushed a commit to etorreborre/framework that referenced this issue Dec 3, 2014
@dpp dpp Closes #938. Closes #1095. Better support to asJsExp in foreign key r…
…eferences. Better handling of Nullable fields in forms and display
d2d60df
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment