Hi Liftlers,
I am migrating one of my application to the lift as a way to learn it and i
would like to ask a question.

After submitting a form i would like to do a redirect and show the submitted
values on the other template. I have 2 templates and i use the same snippet
in both of them to render a dynamic content.
As far as i understand there are 2 ways to make it work: saving state using
SessionVars(which works for me) or extending StatefulSnippet and calling
this.redirectTo on it (looking at the sources it should register the
stateful snippet in the session). I've tried extending StatefulSnippet but
it doesn't work for me. A hashed value is added to the redirect url which
should map to the stateful snippet but the state is lost. I don't understand
what i am doing wrong.

The simplified example of the code:

class MySnippet extend StatefulSnippet {
  private var myValues: List[String] = List()

  val dispatch.. = {
    case "save" => save_
    case "show" => show _
  }

  def show = {
    myValues.foreach(Log.info(_)) //nothing here
  }

  def save(xhtml: NodeSeq) : NodeSeq = {
    def processForm = {
      myValues.foreach(Log.info(_)) //submitted values are printed out
      this.redirectTo("/show")
    }

    bind("render", xhtml,
       ...... //render textboxes and register functions which add values to
the myValues list
       "submit" -> submit("Submit", processForm)
  }
}

Thanks,
Sergey
P.S. The more i learn about Lift the more i like it. Thank you David and all
lift committers!!!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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