Hi. I tried the new functionality. Step 1 works: In my edit client link function I call S.setSnippetForClass("Clients", editSnippet) and it brings up the page, using the correct snippet. Now the editing page has a submit button, "Duplicate", which for testing purposes I commented out its function to do nothing. When the snippet has been instantiated by Lift internally, clicking Duplicate correctly reuses the snippet when it reloads the page. However when the snippet was pre-registered using S.setSnippetForClass, the submit button causes a new snippet to be instantiated for the reload. Even registerThisSnippet doesn't work -- it's necessary to call setSnippetForClass in the submit function. Not that that's such a big deal but it's probably not the intended behavior. So in short, S.setSnippetForClass works but doesn't survive a reload via a submit button, nor does registerThisSnippet extend its lifetime. Thanks.
------------------------------------- David Pollak<feeder.of.the.be...@gmail.com> wrote: I opened a ticket for this. I'll expose functionality so you can register stateful snippets as part of the request process. On Sun, Oct 25, 2009 at 1:09 PM, Naftoli Gugenheim <naftoli...@gmail.com>wrote: > > This may be more of a feature request than a question. > I generally use StatefulSnippets rather than RequestVars. I have several > places in my Lift webapp where one should be redirected to a screen managed > by a StatefulSnippet. Until recently I thought it would suffice to use > S.mapSnippet to map the StatefulSnippet's method as a function. > However, this approach has two shortcomings: (1) If the page uses multiple > snippet methods it become tedious to write mapSnippet for each one. (2) > Since the snippet can't be registered because it can only get a snippetName > via private[http] API, any stateful links, redirects, or submits don't work. > Of course a workaround may be custom replacement methods on the snippet that > use multiple mapSnippets rather than registerThisSnippet, but again this can > become tedious. > Would it be possible to create a public API either to assign a snippet its > name so it can be registered, or to retreive a snippet by name? Or better > yet, assign its name in its constructor or the first time > registerThisSnippet etc. is called? > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---