I think he might just mean the last submitted value for this particular form instance, in which case you want a RequestVar, not a SessionVar.
On Tue, Dec 8, 2009 at 8:22 AM, Alex Boisvert <[email protected]>wrote: > You should use a SessionVar or a stateful snippet. > > Here's how you would use a SessionVar, > > object lastSubmittedDate extends SessionVar[Date](new Date) > > ... > bind(..., > "date" -> SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_), > "class" -> "datepicker"), > > alex > > > On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu <[email protected]> wrote: > >> I want the date field keep the last submited value. I tried with >> below code, but it's dosn't work. The date value(display in page) >> awalys the date of today. >> >> the form: >> <lift:mySnippet.form1 form="POST"> >> <f:date/> >> <f:submit/> >> </lift:mySnippet.form1> >> >> MySnippet: >> >> class MySnippet extends StatefulSnippet { >> val dfmt = new SimpleDateFormat("yyyy-MM-dd") >> var date = dfmt.format(new Date) >> >> val dispatch: DispatchIt = { >> case "form1" => form1 _ >> } >> >> def form1(in: NodeSeq): NodeSeq = { >> bind("f", in, >> "date" -> SHtml.text(date, date = _, >> "class" -> "datepicker"), >> "submit" -> SHtml.submit("submit", println("submit: " + >> date)) >> ) >> } >> >> -- >> >> 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]<liftweb%[email protected]> >> . >> For more options, visit this group at >> http://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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://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 [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.
