What do you mean these functions are called only on submit? Is that when the POST goes through and the page is rendered again?
On Jan 27, 1:57 am, Adam Warski <[email protected]> wrote: > Hello, > > > What's the purpose of RequestVars and StatefulSnippet? I thought the > > values were retained anyway through POST. That is, on submit, the > > functions "desc = _" and "amount = _" were executed and the so the > > state was kept... > > > Are those functions only executed after the bind is complete? There > > must be something I'm missing here. > > The functions are called after form submission, and the variable "desc" and > "amount" will be updated. However those variables will belong to the original > method call. So when the page is re-rendered (e.g. because of validation > errors), the "add" method will be called again, and fresh variables will be > created. So the values won't be retained. If you want to keep the values > between updating and re-rendering, you need something more global, like a > RequestVar or a StatefulSnippet. > > -- > Adam Warskihttp://www.warski.orghttp://www.softwaremill.eu -- 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.
