Hi All,

Using CRUD methods, in a controller I have: -

def update():
    crud.settings.showid = True
crud.settings.update_next = URL('view', args=[request.args(0),request.args(1)])
    return dict(form=crud.update(db.accmgr,
        request.args(1)))

...and update_next takes me to view the record updated, using the id in the request to identify the record.

If I try to do the equivalent with an insert, I need to access the ID of the inserted record, which I had understood to be accessible via "form.vars.id" but if I try: -

def add():
crud.settings.create_next = URL('view', args=['accmgr', form.vars.id])
    return dict(form=crud.create(db.accmgr))

...I get an error ticket telling me that "form is not defined".

I have read that "form.vars.id" works with "onaccept", because "onaccept" is called with "form" as a parameter after the form is
accepted, but that does not seem to apply here.

Do I need to somehow explicitly make the "create_next" conditional on the form having been accepted, or is there a different syntax I can use to access the "id", or am I on the wrong track entirely?


--

Cheers,

Clam

Reply via email to