it appears that the user still creates a new User. it is because I
tell it to do that each time a new request is made.
// Set up a requestVar to track the user object
object userVar extends RequestVar(new User())
So I guess my question is how prevent it from doing that and still
pass a User object to the RequestVar I tried a RequestVar[User] but no
bueno
below is the snippet code for registering a user
user.password = passwordHashed
user.activationCode = activationCode
user.userProfile.user = user
user.userPreferences.user = user
Model.mergeAndFlush(user)
MailUtils.mailConfirmationLetter(user)
S.redirectTo("thank_you", () => { println(user); userVar(user);}
In the mean time I'm going to just extract the email and fullname from
the user and pass it as a request param
user.password = passwordHashed
user.activationCode = activationCode
user.userProfile.user = user
user.userPreferences.user = user
Model.mergeAndFlush(user)
MailUtils.mailConfirmationLetter(user)
val email = user.email
val fullName = user.userProfile.fullName
println("email " + email)
S.redirectTo("thank_you", () => {S.set("email", email); S.set
("fullName", fullName);})
Thanks for helping out
On Jan 27, 10:20 pm, Naftoli Gugenheim <[email protected]> wrote:
> Can you put a trace in that closure to see if 'user' has the correct value?
> S.redirectTo("thank_you", () => {println(user); userVar(user);})
> etc.
>
> On Wed, Jan 27, 2010 at 11:51 PM, Jay Cain <[email protected]> wrote:
> > I think that this would work....
>
> > // Set up a requestVar to track the user object
> > object userVar extends RequestVar(new User())
>
> > S.redirectTo("thank_you", () => {userVar(user);})
>
> > but no bueno.
>
> > On Jan 27, 4:56 pm, Naftoli Gugenheim <[email protected]> wrote:
> > > When you redirect you start a new request, so RequestVars are fresh.
> > > redirectTo has an overload that take additionally a function to execute
> > in the new request. Set the RequestVar there.
>
> > > -------------------------------------
>
> > > Jay Cain<[email protected]> wrote:
>
> > > I am a newbie to Lift and Scala. I'm registering users and once they
> > > have entered the information in successfully. I want to redirect to a
> > > "thank_you" page that will display a snippet
>
> > > <lift:UserOps.thanksMessage>
> > > <p>
> > > <entry:fullname/> thanks for joining Echo. The
> > > confirmation
> > > instructions for completing the signup process have been
> > sent to
> > > your email address, <entry:email/>
> > > </p>
> > > </lift:UserOps.thanksMessage>
>
> > > I assume that when I redirect it doesn't hold the state of the user
> > > information.
>
> > > On submit I invoke signup
>
> > > def signup(xhtml: NodeSeq) : NodeSeq = {
> > > ........
> > > S.redirectTo("thank_you")
>
> > > }
>
> > > ThanksMessage function....................
>
> > > def thanksMessage(xhtml: NodeSeq) : NodeSeq = {
> > > print("Username: " + user.username)
> > > bind("entry", xhtml,
> > > "fullname" -> Text(user.userProfile.fullName),
> > > "email" -> Text(user.email))
>
> > > }
>
> > > I have declared a RequestVar object
>
> > > ** object userVar extends RequestVar(new User()) **
>
> > > but I'm sure that it is creating an empty user object in my RequestVar
> > > userVar when I redirect.
>
> > > Is a StatefulSnippet the solution for this? I just think that there's
> > > a much simpler solution that I'm overlooking.
>
> > > Jay
>
> > > --
> > > 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 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 [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.