Maybe this is already in place and I just missed it.
I have a page with a form, this page has a named Comet Actor, the name
is saved on a SessionVar, so that the snippet that does the render of
the form can access the name of the comet actor. Once you submit the
form, the comet actor name is pass to a LiftActor as part of the
message to process. Once the LiftActor finishes his work, it goes and
tells the named actor to display a message on the browser.
Using this technique, I can have my page loaded on Firefox and another
instance of this page on Safari, and they do not step on each other,
the comet actor will only update the browser that submitted the form.
Well, unless you have two tabs open on FF, in which case both tabs get
the message.
So I thought that if I had a TabVar, I could store the comet name
there, and each tab on FF would have its own instance. Or how can I
achieve this?
At first I used a RequestVar, but on page reload (form submitted), I
would loose the value.
I set the value of the SessionVar if it is empty, if present, I use
the name stored there.
Thanks
Diego
P.S. sample app is here:
https://github.com/fmpwizard/lift-conditional-drop-down-menus
it is the LiftActor link on the left menu.
--
Diego Medina
Web Developer
http://www.fmpwizard.com
That was the way I first tried, but my problem was that after I
submitted the form, I would get a new comet actor, and my liftactor
had no idea of this new name.
(btw, I removed a dependency to reactive web on my sample app)
Thanks
> --
> 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.
Hi Antonio,
That was the way I first tried, but my problem was that after I
submitted the form, I would get a new comet actor, and my liftactor
had no idea of this new name.
Ah, I now remember you posted something like that before, and note I get to use it :)
Thanks!
Sent from my cell
Diego Medina
Once I publish a post about using just Lift, I'll work on another
sample to see how reactive would do the same. Then people will have
more options and can choose the way they feel fit their needs.
Regards,
Diego
object cometName extends RequestVar[Box[String]](Empty)
def render ={
...
def snapshot(): () => Unit = {
val cn = cometName.get
() => {cometName.set(cn)}
}
...
"type=hidden" #> SHtml.hidden(snapshot())
}
And it works beautifully!
Now to write a longer post explaining this and my initial work with LiftActors
Thanks
Diego
Just for completeness, this is the code I ended up using to store the
name of the comet actor on a RequestVar and use the snapshot
technique:
object cometName extends RequestVar[Box[String]](Empty)
def render ={
...
def snapshot(): () => Unit = {
val cn = cometName.get
() => {cometName.set(cn)}
}
Thanks for adding this