usually when I use S.notice and friends it goes something like this
...calculations...
S.notice("W00t, all went well")
redirectTo("meaningful/page")
Now I'm in a situation where the redirect is a javascript RedirectTo instead and the S.notice(..) doesn't show up. I should say that this
is inside a CometActor and the code is like this:
val url = ....
S.notice("Succesfully saved things")
partialUpdate(RedirectTo(url))
First off, is this the expected behavior that the notice doesn't show?
If it is I think it would be nice to add something like
RedirectToWithNotices(List[Box[String]])
RedirectToWithErrors(List[Box[String]])
.... etc.
or at least something that would allow for a js redirect and show a message.
Thanks,
Mads Hartmann Jensen
On 3 Nov 2010, at 10:27, Mads Hartmann Jensen wrote:
> usually when I use S.notice and friends it goes something like this
>
> ...calculations...
> S.notice("W00t, all went well")
> redirectTo("meaningful/page")
>
> Now I'm in a situation where the redirect is a javascript RedirectTo instead and the S.notice(..) doesn't show up. I should say that this
> is inside a CometActor and the code is like this:
>
> val url = ....
> S.notice("Succesfully saved things")
> partialUpdate(RedirectTo(url))
>
> First off, is this the expected behavior that the notice doesn't show?
Anecdotal evidence only, but when I've done this kind of thing with AJAX the notice doesn't show up.
I've taken to using the following pattern, but I can't remember where I acquired it. I think it was a thread on this list, but I can't find it in my local mail.
RedirectTo(S.mapFuncToURI(url, () => {
S.notice(msg)
S.redirectTo(url)
}))
I've not tried it with Comet, but it works with AJAX redirects.
That said, some sugar for this would be welcomed :)
Cheers,
D
Looks promising, will try it out.
Mads Hartmann
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
Thanks for that David. Just needed that bit of code today!
My guess why it behaves this way:
> Anecdotal evidence only, but when I've done this kind of thing with AJAX the notice doesn't show up
S.notice / warning / error works the same way for ajax and "common
http" requests. So if you fill S.error in a ajax request, the ajax
response itself will contain and therefore bind the error messages on
the current page (S messages are cleared). Unfortunately, our response
contains a RedirectTo too and just jumps away from the current page to
our target page.
So I think that S.notice / warning / error do show up but only for a
very limited time.
Daniel
> > usually when I useS.notice and friends it goes something like this
On 3 Nov., 13:35, David Brooks <davidjamesbro...@gmail.com> wrote:
> Hi Mads,
>
> On 3 Nov 2010, at 10:27, Mads Hartmann Jensen wrote:
>
>> > Now I'm in a situation where theredirectis a javascript RedirectTo instead and theS.notice(..) doesn't show up. I should say that this
> > ...calculations...
> >S.notice("W00t, all went well")
> > redirectTo("meaningful/page")
>
> > is inside a CometActor and the code is like this:
>
> > val url = ....
> >S.notice("Succesfully saved things")
> > partialUpdate(RedirectTo(url))
>
> > First off, is this the expected behavior that the notice doesn't show?
>
> Anecdotal evidence only, but when I've done this kind of thing with AJAX the notice doesn't show up.
>
> I've taken to using the following pattern, but I can't remember where I acquired it. I think it was a thread on this list, but I can't find it in my local mail.
>
> RedirectTo(S.mapFuncToURI(url, () => {
> S.notice(msg)
> S.redirectTo(url)
>
> }))
>
> I've not tried it with Comet, but it works with AJAX redirects.
>
> That said, some sugar for this would be welcomed :)
>
> Cheers,
> D
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.