if you use
form=SQFORM(db.table)
if form.accepts(request.vars,session):
# the id in form.vars.id
redirect(....)
return dict(form)
if you use
form=crud.create(db.table)
the accept and redirect are done inside crud create therefore there is
no scope where you can access the form.vars.id. You can do
form=crud.create(db.table,onaccept=lambda form: do_something_with
(for.vars.id))
that will be executed before redirection.
On May 22, 2:28 pm, NewBeen <[email protected]> wrote:
> The problem is that the answer is given just don´t work,
> if you look to the code i post is the code in the answer and always
> return none ;)
>
> On May 22, 7:21 pm, Wes James <[email protected]> wrote:
>
> > got tohttp://groups.google.com/group/web2py
>
> > then do a search on "id of last record" ;)
>
> > -wes
>
> > On Fri, May 22, 2009 at 1:18 PM, NewBeen <[email protected]> wrote:
>
> > > I'm using the crud.create() function but i can not get the id of the
> > > last create record,
>
> > > I try to do like this in the controller
>
> > > ### CODE ###
>
> > > response.flash='last id is %s' % form.vars.id
> > > #####
>
> > > Always return None
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---