session.emailvariable = request.vars.email
Because the above is in a model file, it runs on every request. After the
form has been submitted, on subsequent requests, the value of
request.vars.email will be None, so you are simply overwriting the value
originally stored in the session. Instead, do something like:
if request.vars.email:
session.emailvariable = request.vars.email
Anthony
On Monday, August 5, 2013 11:01:08 PM UTC-4, Jake Angulo wrote:
>
> Im trying to set the following session variable in models file:
> "session.emailvariable"
>
> And later retrieve it in a view as:
> <p1>Session.emailvariable = {{=session.emailvariable}}</p1>
> .........
> <input type="hidden" name="custom" value="{{=session.emailvariable}}">
> ........
>
> This is my models (db.py):
> db.define_table(
> auth.settings.table_user_name,
> Field('email', length=128, default='', unique=True),
> ...........
> session.emailvariable = request.vars.email
>
>
> I just want the user-input "email" field to be stored into session.
>
> I tried various ways, including response.vars and i end up getting empty
> string "" or "None"
>
>
> Can you pls point out how to properly do this?
> I'd appreciate your help!
>
>
> Jake
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.