Hi.

Do something like this:
form = SQLFORM(db(db.company),fields = ['compname','designation','location'])
if form.accepts(request.vars, session):
    db(db.company.id == form.vars.id).update(userid = session.userid)
    # do something else like redirect if needed

The id of the new record can be found in form.vars.id after it was inserted.
This way you'll update the new record after it was inserted.

regards
mmlado

On Wednesday 03 June 2009 13:42:34 durga wrote:
> hi,
>
> i would like to insert a values to a table  through form where user
> can enter fewer fields.
>
> for example i have table 'company'  which has fields
> userid,compname,designation,location.
>
>  form = SQLFORM(db(db.company),fields=
> ['compname','designation','location'])
>
>  userid is stored in session as session.userid
>
>  in this case user can enter 3 fields through form but i want userid
> also to be updated at the same time in to company table.
>
> can some one help me how to update all 4 fields at a time.
>
> thanks
> durga


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to