Thanks Timothy for your advice.

On Feb 6, 3:16 pm, Timothy Perrett <timo...@getintheloop.eu> wrote:
> wow, thats some ugly code man. Why dont you try something like:
>
> def validateAndSave {
>   currentEntry.validate match {
>     case Nil =>
>       currentEntry.save
>       S.notice(currentEntry.title + "SAVED!")
>     case List(fielderror) => S.error(fielderror.msg)
>     case _ =>
>   }
>
> }
>
> I havent tested it of course, but just wanna show you how you could tidy up 
> your code somewhat.
>
> Cheers, Tim
>
> On 6 Feb 2010, at 13:51, wibblecp wrote:
>
>
>
> > def validateAndSave (): Unit = currentEntry.validate match {
> >      case Nil => currentEntry.save ; S.notice(currentEntry.title + "
> > SAVED!")
> >      case x => { x map { (e:FieldError) => S.error(e.msg) } }
> >    }

-- 
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.

Reply via email to