>From the book: "next is the URL to redirect to after success. If the
URL contains the substring "[id]" this will be replaced by the id of
the record currently created/updated."

While I haven't used that specifically I would say:

form=crud.create(db.atable,next=URL(r=request,f='atable_read',args=['[id]']),message=T('form
accepted'))

It's my understanding that it will generate the URL:
Since [id] is replaced with the ID you should be able to access it
with: request.args[0]
Depending on what you're doing you might also look at the onaccept
parameter of CRUD.  I use that to run a function and fill out some
custom auth_user fields after a new user is created.


On Jun 30, 3:52 pm, Jean-Guy <jean...@gmail.com> wrote:
> Hello,
>
> How may I pass the id of my entered record to an other function??
>
> def atable_create():
>     if auth.has_membership(auth.id_group('group1')):
>
> form=crud.create(db.atable,next=URL(r=request,f='atable_read'),message=T('form
> accepted'))
>     elif form.errors:
>         response.flash = T('form has errors')
>     else:
>         response.flash = T('please fill out the form')
>     return dict(form=form)
>
> def atable_read(...):
>      form=crud.read(db.atable,4)
>      return dict(form=form)
>
> Thanks
>
> Jonhy

Reply via email to