Is this "currentClient(Full (c)), Text ("Ajouter Facture"))" called on
page X and ViewClient.add snippet on page Y?If you want to preserve state between pages than you should use SessionVars. I don't know what "Destination Post snippet" means. On Mar 9, 8:13 am, hexa <[email protected]> wrote: > Hi, > I have a RequestVar that I send to a snippet which will then do a > post... > > But I would like the RequestVar to persist between the moment it it > received in the post snippet and the post itself... > > The only way I found of doing it right now is like : > > Source Snippet : > > object ViewClient extends ViewClient > > class ViewClient > { > object currentClient extends RequestVar [Box [Client]] (Empty) > > bind (... > "addInvoice" -> SHtml.link ("/invoice/create", () => currentClient > (Full (c)), Text ("Ajouter Facture"))) > > Destination Post Snippet : > > def add (inhtml: NodeSeq) : NodeSeq = { > > val inInvoice = Invoice.create > val clientBox = ViewClient.currentClient > > val client_id = clientBox map (_.id.toLong) > > def processEntry () { > Client.findByKey (client_id openOr 0) map (inInvoice.client (_)) > inInvoice.save > S.notice ("Entre : Description " + inInvoice.description + " > Montant : " + inInvoice.amount) > } > > bind ("e", inhtml, > "description" -> inInvoice.description.toForm, > "amount" -> inInvoice.amount.toForm, > "submit" -> SHtml.submit ("Ajouter Facture", processEntry)) > > If I try to access the clientBox in processEntry, even with the > closure it should generate.. I get an empty box... > > Is there any way to copy / ref or anything or make a new RequestVar > with a copy of the preceding one ? > > Would have been nice not to be obligated to do the client_id toLong > code... > And juste do inInvoice.client (client) , inInvoice.save > > Thanks a lot > > hexa -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
