On Dec 9, 3:41 pm, Xuefeng Wu <ben...@gmail.com> wrote: > Hello Marius, > > I have an other question about S.error. > When I use: S.error("can not delete this department.") > > I get: > try{jQuery("#lift__noticesContainer__").each(function(i) {this.innerHTML = > "<div>Error<ul><li>can not delete.</li></ul> </div>";});} catch (e) {} > > What I want this > try{jQuery("#*lift__noticesContainer___error*").each(function(i) > {this.innerHTML = "<div>Error<ul><li>can not delete.</li></ul> </div>";});} > catch (e) {} > > Why it's lift__noticesContainer__ but not lift__noticesContainer___error? > > Did I miss something?
lift__noticesContainer__ is the reserved container name for notices that are not bound to element ID's. However when you call S.error(xs) where xs is a List[FieldError] those messages are bound to the ID contained by FieldError.uniqueFieldId. Are you using <lift:msgs> or <lift:msg> snippet? If you are using <lift:msgs> that this will render all errors, warnings and notices. The distinction between them is given by error_class, warning_class or notice_class If you are using <lift:msg id="my-id"/ > then this will render only messages bound this my-id. Therefore only FieldError that have uniqueFieldId="my-id". So if you have a form like: Name: <input type="text"/><lift:msg id="name-id"/> Age: <input type="text"><lift:msg id="age-id"/> In this way you can set selectively set messages for fields that fail to validate. For lift:msg you can also specify errorClass, warningClass or noticeClass attributes to set CSS classes. But obviously you can also set styles by id. > > > > On Tue, Dec 8, 2009 at 9:23 PM, Marius <marius.dan...@gmail.com> wrote: > > Yes you need to send down fadeOut... call > > > def myFunc: JsCmd = { > > // do some DB stuff > > vmyMapper.validate match { > > case Nil => Noop > > case xs => S.error(xs); fadeOutErrors(5 seconds, 1 second) > > } > > > } > > On Dec 8, 3:01 pm, Xuefeng Wu <ben...@gmail.com> wrote: > > > Yes, I do something like > > > // do the DB stuff > > > vmyMapper.validate match { > > > case Nil => > > > case xs => S.error(xs) > > > } > > > > But I should always add fadeOutErrors(5 seconds, 1 second)? > > > > I want lift highlight every error/notice information. > > > > On Tue, Dec 8, 2009 at 5:56 PM, Marius <marius.dan...@gmail.com> wrote: > > > > 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> > > > > > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com> > > <liftweb%252bunsubscr...@googlegroups.com<liftweb%25252bunsubscr...@googlegroups.com> > > > > > > > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com> > > <liftweb%252bunsubscr...@googlegroups.com<liftweb%25252bunsubscr...@googlegroups.com> > > > > > <liftweb%252bunsubscr...@googlegroups.com<liftweb%25252bunsubscr...@googlegroups.com> > > <liftweb%25252bunsubscr...@googlegroups.com<liftweb%2525252bunsubscr...@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> > > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com> > > > > > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com> > > <liftweb%252bunsubscr...@googlegroups.com<liftweb%25252bunsubscr...@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> > > <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.