[Lift] Validations

2009-11-25 Thread suls
Hi guys,

It seems that I don't completely understand how validations work.. I
am having a model with the following property:

object size extends MappedInt(this) {
override def validations =  validPosition _ :: super.validations

def validPosition(in: Int): List[FieldError] =
  if (-100 until 101 contains in) Nil
  else List(FieldError(this, bPosition size must not be greater
than +/- 100/b))
  }

And in the snippet I do the following:

pos.validate match {
  case Nil = pos.save; S.notice(Position change 
 + pos.size +  for 
 + pos.dateOf.asHtml +  successful.)

  case xs = S.error(xs); Log.error(. + xs)
}

Now something I cannot explain to myself happens: If the validation
fails, the error gets logged on the console but not displayed in the
browser:

ERROR - .List(Full(position_size) : bPosition size must not be
greater than +/- 100/b)

Am I getting something wrong with how validations work?

Cheers, suls

--

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




Re: [Lift] Validations

2009-11-25 Thread David Pollak
On Wed, Nov 25, 2009 at 11:52 AM, suls s...@suls.org wrote:

 Hi guys,

 It seems that I don't completely understand how validations work.. I
 am having a model with the following property:

 object size extends MappedInt(this) {
override def validations =  validPosition _ :: super.validations

def validPosition(in: Int): List[FieldError] =
  if (-100 until 101 contains in) Nil
  else List(FieldError(this, bPosition size must not be greater
 than +/- 100/b))
  }

 And in the snippet I do the following:

 pos.validate match {
  case Nil = pos.save; S.notice(Position change 
 + pos.size +  for 
 + pos.dateOf.asHtml +  successful.)

  case xs = S.error(xs); Log.error(. + xs)
}

 Now something I cannot explain to myself happens: If the validation
 fails, the error gets logged on the console but not displayed in the
 browser:

 ERROR - .List(Full(position_size) : bPosition size must not be
 greater than +/- 100/b)

 Am I getting something wrong with how validations work?


In your default template (templates-hidden/default.html) change lift:Msgs
/ to lift:Msgs showAll=true/

A few months back, we changed MappedFields to having a field identifier.
 The default Msgs does not render error messages on fields with a field
identifier set.



 Cheers, suls

 --

 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@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
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

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