It is not set in the same request as it's being read exactly... But how is that doable with RequestVars then ?
On Mar 9, 11:55 am, Naftoli Gugenheim <naftoli...@gmail.com> wrote: > You can use StatefulSnippets if you like, but what you want to do is > perfectly doable with RequestVars. > Clearly it's not being set in the same request as it's being read. > > ------------------------------------- > > hexa<hex...@gmail.com> wrote: > > I think we still have a miss understanding > > The client_id code clientBox map (_.id.toLong) work ok .. no problems > with that > > What doesnt work would be doing something like : > > val clientBox = ViewClient.currentClient > > def processEntry () { > inInvoice.client (clientBox.open_!) > inInvoice.save > S.notice ("Entre : Description " + inInvoice.description + " > Montant : " + inInvoice.amount) > } > > Since in this case inInvoice.client (clientBox.open_!) return an empty > box since the RequestVar has been destroyed ... > > So I was trying to do this but I need to copy or ref the RequestVar so > that I use it in the next request... > > At first I tought because of the closure it would ref it... but it > seems not.. > > It's looking more and more like a statefull snippet is the way to > go... > On Mar 9, 11:10 am, Lukasz Kuczera <kuk...@gmail.com> wrote: > > > > > Ok i think I see the "bug". It is the magic which i don't understand > > yet that if you change your client_id from val to var it will be auto > > promoted into Heap and live out Snippet. Try this out. > > > Change: > > val client_id = clientBox map (_.id.toLong) > > To: > > var client_id = clientBox map (_.id.toLong) > > > On Mar 9, 3:34 pm, hexa <hex...@gmail.com> wrote: > > > > Hi, thanks for the suggestions I like that match {} code.. will try > > > that.. > > > > But what you suggest but the post_id is similar to what I'm doing > > > now.. since this id is a long it will be copied by value > > > and I can pass it to multiple requests using a closure... > > > > I'll try to clarify a bit : > > > > A have a ViewClient snippet and an AddInvoice snippet > > > > In the ViewClient I add the action AddInvoice which must be bound to > > > a client.. > > > > Now passing the client to the AddInvoice form is ok .. I can send the > > > whole client object to the form snippet using a RequestVar.. > > > which I find kinda neet not having to go trough thoses ids... (maybe > > > i'm wrong thinking that) > > > > But the trick is now that i'm in the AddInvoice snipped and that I > > > have my RequestVar... > > > > I would like to form a closure on it.. an keep it for the post request > > > so that it gets to ProcesssEntry and I do just : > > > > inInvoice.client (client) > > > inInvoice.save > > > > As so no ids are involved... > > > > I would need to make a new RequestVar for the post submit with a copy > > > of the input RequestVar I got in the AddInvoice from the ViewClient > > > snippet > > > > But a SessionVar is out it's way overkill and a statefull snippet.... > > > might be an idea ... would the RequestVar persist in the statefull > > > snippet? > > > > Also I'm having trouble understanding how that scoping is done for the > > > RequestVar if anyone could shed some light on it... like why a closure > > > won't "ref" it... (I'm new to scala) > > > > Thanks > > > > hexa > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.