Are you using field validate into an Ajax context or not? If not using
something like:

def howdy = {
    S.error("howdy error")
    <span>Hello there</span> ++
    <head>{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
    </head>
  }

from your snippet should be ok.

If you are using validate from an Ajax invocation, then you just need
to return fadeOutErrors(5 seconds, 1 second) from your Ajax function.

So I guess your ajax function would looks something like:

def myDBAjax: JsCmd = {

  // do the DB stuff
  val errors = myMapper.validate
  S.error(errors)
  fadeOutErrors(5 seconds, 1 second)
}


Br's,
Marius

On Dec 8, 10:53 am, Xuefeng Wu <ben...@gmail.com> wrote:
> But I use field validate, the notice and error are wrap by lift. Should I
> append fadeOutErrors(5 seconds, 1 second)?
>
>
>
> On Tue, Dec 8, 2009 at 4:50 PM, Marius <marius.dan...@gmail.com> wrote:
> > You don't need to configure anything in boot.
>
> > Assume this is an Ajax function:
>
> >  def howdy: JsCmd = {
> >    S.error("howdy error")
> >    fadeOutErrors(5 seconds, 1 second)
> >  }
>
> >  ... in your snippet you can say:
>
> >  SHtml.a(Text("Click me")(howdy _)
>
> >  If you want to fade out errors in a page and not via Ajax you can
> > use this:
>
> >  def howdy = {
> >    S.error("howdy error")
> >    <span>Hello there</span> ++
> >    <head>{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
> >    </head>
> >  }
>
> >  which basically says after the page is rendered that after 5 seconds
> > the error notices will be faded out.
>
> > Br's,
> > Marius
>
> > On Dec 8, 9:50 am, Xuefeng Wu <ben...@gmail.com> wrote:
> > > Yes, it's my wanted.
> > > How could I configure it at boot?
>
> > > On Tue, Dec 8, 2009 at 3:44 PM, Marius <marius.dan...@gmail.com> wrote:
> > > > Please see this:
>
> > > >http://groups.google.com/group/liftweb/browse_thread/thread/972562da2.
> > ..
>
> > > > If you are using Ajax, notices could easily fade out.
>
> > > > Br's,
> > > > Marius
>
> > > > On Dec 8, 8:02 am, Xuefeng Wu <ben...@gmail.com> wrote:
> > > > > Hi,
>
> > > > >     I want to highlight the lift notice and it will hide when
> > timeout.
> > > > > Should I code every request or only to config lift some where?
>
> > > > > For example:
> > > > > When use put items into the shopping cart, highlight the items some
> > > > seconds
> > > > > to notice the user.
>
> > > > > --
> > > > > Scala中文社区:  http://groups.google.com/group/scalacn
>
> > > > --
>
> > > > 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<liftweb%2bunsubscr...@googlegroups.com>
> > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > Scala中文社区:  http://groups.google.com/group/scalacn
>
> > --
>
> > 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<liftweb%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Scala中文社区:  http://groups.google.com/group/scalacn

--

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