On Thu, May 7, 2009 at 5:40 AM, wapgui <torsten.schm...@wapgui.com> wrote:

>
> Hi all,
>
> I have a normal form defined via bind.
>
> object smlink extends RequestVar(Full(""))
>  val widget = new Widget()
>
>  def show(xhtml: NodeSeq): NodeSeq = {
>    var smallLink = ""
>    var dlText = ""
>
>    if (smlink.isEmpty || smlink.open_!.length == 0) {
>      Log.debug("Starting new widget generation")
>    } else if (!smlink.open_!.startsWith("Error")) {
>      Log.debug("Widget generation successfull")
>      smallLink = smlink.open_!
>      dlText = "Download here"
>    } else {
>      Log.debug("Widget generation unsuccessfull")
>      dlText = smlink.open_!
>    }
>
>    bind("widget", xhtml,
>      "title" -> text(widget.title, widget.title = _) % ("size" ->
> "10") % ("id" -> "title"),
>      "url" -> text(widget.url, widget.url = _) % ("size" -> "56") %
> ("id" -> "url"),
>      "submit" -> submit("Generate", () => {
>        smlink(Full(buildWidgetPackage(burl,widget)))
>      }),
>          "link" -> <a href={smallLink}>{dlText}</a>
>    )
>  }
>
> After submit the inputs are tested and errors return a string with the
> specific error message. The message is shown as link, but all the
> inputs are gone after reloading the page to show the error.
> Is there a way to get the widget object after submit to set the values
> in the form to the submitted values? Maybe it is in smlink or should I
> use a tuple to return the widget object from the buildWidgetPackage
> function.
>

Try using a StatefulSnippet (make your snippet a subclass of
StatefulSnippet).  That will use the same snippet across form submissions.

If you need a more detailed explanation, please let me know and I'll work
one up for you.


>
> Thanks,
> Torsten
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
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