Try:

S.fmapFunc(registerThisSnippet)(binding => JsCmds.RedirectTo("/ 
workflow/index?" + binding + "=_"))

?

I'm not sure this is the right way to do it, but I think that should  
work.

-Ross


On Oct 5, 2009, at 3:45 PM, David wrote:

>
> Ok so I tried using registerThisSnippet:
>
>           "save" -> SHtml.ajaxButton(
>             "Save",
>             {() =>
>              registerThisSnippet
>              println("currentSnippet: " + S.currentSnippet)
>              JsCmds.RedirectTo("/workflow/index") })
>
> Maybe I am doing something wrong.  The redirect happens, but then when
> in my StatefulSnippet, I cannot access variables that were previously
> set.
>
> I believe that this JsCmds.RedirectTo() is not setting the "function
> name" in the query string as if I were using StatefulSnippet.redirect
> or StatefulSnippet.link.  Also, I checked to see if the currentSnippet
> is set,  it prints:  currentSnippet: Empty
>
> Thanks, for any help.
>
> -Dave
>
>
> On Sep 25, 2:12 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
>> Try calling registerThisSnippet in the redirect function.
>>
>> -------------------------------------
>>
>> David<david.b...@gmail.com> wrote:
>>
>> Thank you, that mostly worked!
>>
>> I forgot to mention that I'm using StatefulSnippet, and the place
>> where the redirect is happening should redirect to a different url,
>> but the different url is backed by the same StatefulSnippet instance.
>> So when I use JsCmds.RedirectToI'm not getting the same
>> StatefulSnippet instance.  Is there a way to redirect that will
>> preserve my StatefulSnippet instance?
>>
>> url/a(StatefulSnippet)
>>   -> links to url/b(StatefulSnippet) using super.link()
>>   url/b - redirects back to url/a
>>
>> url/a is a grid, with a starting 'page' number, and url/b is a edit
>> form.  When the user is done with url/b they click 'save' which sends
>> them back to url/a, hopefully at the same place in the grid.  When
>> returning to the grid from the edit page, the grid is reloading from
>> the beginning.   I need a way to preserve the original  
>> StatefulSnippet
>> instance.
>>
>> Thanks, Dave
>>
>> On Sep 25, 4:26 am, Timothy Perrett <timo...@getintheloop.eu> wrote:
>>
>>> Just realised your using ajaxForm... in that case you need to do
>>> RedirectToJsCmd which will effectively send a window.location.href  
>>> to
>>> the browser.
>>
>>> Cheers, Tim
>>
>>> On 24 Sep 2009, at 21:49, David wrote:
>>
>>>> Hello lifters,
>>>> I have the following form and bind:
>>>>    SHtml.ajaxForm(
>>>>      bind("ajax", xhtml,
>>>>           "view" -> doView _,
>>>>           "save" -> SHtml.ajaxButton(
>>>>             "Save",
>>>>             {() =>
>>>>               Log.info("Got a 'save' AJAX call")
>>>>              this.redirectTo("/redirect1") //workflow/index2
>>>>            }, ("class", "ui-state-default ui-corner-all"))))
>>
>>>> When the 'Save' ajax button is called, the redirect should be  
>>>> invoked,
>>>> that is working.  However I get the exception below.   Based on  
>>>> what
>>>> I've read, this exception should be handled by lift.  I don't  
>>>> have any
>>>> explicit exception handling in my code.
>>
>>>> Is there a bug here, is my redirect correct?  I've also tried  
>>>> adding
>>>> this to my Boot.scala:
>>>>    LiftRules.dispatch.prepend {
>>>>      case Req("redirect1" :: _, _, _) => () =>
>>>>        Full(RedirectWithState("/workflow/index2",
>>>>                               RedirectState(() => println("Called  
>>>> on
>>>> redirect!"),
>>>>                                             "My error" ->
>>>> NoticeType.Error)))
>>
>>>> Thanks for any suggestions or help.
>>
>>>> -Dave
>>>> 16:44:14.097 [12569...@qtp-1983971-5] WARN  lift.warn:114 - Request
>>>> for /ajax_request/F664660567847L4N/ failed Shortcut
>>>> net.liftweb.http.ResponseShortcutException: Shortcut
>>>>    at net.liftweb.http.ResponseShortcutException$.redirect
>>>> (ResponseShortcutException.scala:31) [lift-webkit-1.1- 
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.ResponseShortcutException$.redirect
>>>> (ResponseShortcutException.scala:35) [lift-webkit-1.1- 
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.StatefulSnippet$class.redirectTo 
>>>> (Stateful.scala:
>>>> 77) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na]
>>>>    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151)
>>>> [classes/:na]
>>>>    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149)
>>>> [classes/:na]
>>>>    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply 
>>>> (S.scala:
>>>> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply 
>>>> (S.scala:
>>>> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>>>>    at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift-
>>>> webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
>>>> (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply 
>>>> $17.apply
>>>> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply 
>>>> $17.apply
>>>> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>>>>    at net.liftweb.http.LiftSession$$anonfun$6.apply 
>>>> (LiftSession.scala:
>>>> 338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftSession$$anonfun$6.apply 
>>>> (LiftSession.scala:
>>>> 327) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at scala.List.flatMap(List.scala:1132) [scala- 
>>>> library-2.7.5.jar:na]
>>>>    at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala: 
>>>> 286)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
>>>> $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet$$anonfun$3.apply 
>>>> (LiftServlet.scala:
>>>> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet$$anonfun$3.apply 
>>>> (LiftServlet.scala:
>>>> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala: 
>>>> 904)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$ 
>>>> $_nest2InnerInit$1$
>>>> $anonfun$apply$20.apply(S.scala:1044) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:841)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$ 
>>>> $_nest2InnerInit
>>>> $1.apply(S.scala:1042) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit 
>>>> (S.scala:
>>>> 1041) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
>>>> $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun 
>>>> $apply
>>>> $26$$anonfun$apply$27.apply(S.scala:1061) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
>>>> $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun 
>>>> $apply
>>>> $26.apply(S.scala:1060) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
>>>> $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25.apply 
>>>> (S.scala:
>>>> 1059) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
>>>> $anonfun$apply$23$$anonfun$apply$24.apply(S.scala:1058) [lift-
>>>> webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
>>>> $anonfun$apply$23.apply(S.scala:1057) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit 
>>>> $1.apply
>>>> (S.scala:1056) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.net$liftweb$http$S$$_innerInit(S.scala: 
>>>> 1055)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$ 
>>>> $anonfun
>>>> $apply$31$$anonfun$apply$32$$anonfun$apply$33.apply(S.scala:1084)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$ 
>>>> $anonfun
>>>> $apply$31$$anonfun$apply$32.apply(S.scala:1083) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:119)  
>>>> [lift-
>>>> webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$ 
>>>> $anonfun
>>>> $apply$31.apply(S.scala:1082) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30.apply
>>>> (S.scala:1081) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$$anonfun$_init$1.apply(S.scala:1080)  
>>>> [lift-
>>>> webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)  
>>>> [lift-
>>>> util-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$._init(S.scala:1079) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.S$.init(S.scala:775) [lift-webkit-1.1-
>>>> SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet.doService(LiftServlet.scala:171)
>>>> [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply
>>>> (LiftServlet.scala:75) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply
>>>> (LiftServlet.scala:75) [lift-webkit-1.1-SNAPSHOT.jar:na]
>>>>    at
>>
>> ...
>>
>> read more ยป
> >


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