The fact is crud.delete() does not return a form, ever. If you call
it, it deletes the record.

you can do something like this

def delete():
    task=db.tasks[request.args[0]]
    if request.vars.confirm:
        crud.delete(db.tasks, task.id,next=URL(r=request,f='index'),
message=T('Deleted'),deletable=True)
    else:
        form = BUTTON('really
delete',_onclick='document.location="%s"'%URL(vars=dict(confirm=True)))
    return dict(form = form)


On Oct 1, 4:53 pm, Tom  Campbell <[email protected]> wrote:
> I have a 'Delete' link in my edit view. The controller looks like
> this:
>
> def delete():
>     task=db.tasks[request.args[0]]
>     form = crud.delete(db.tasks, task.id,
> next=URL(r=request,f='index'), message=T('Deleted'),deletable=True)
>     return dict(form = form)
>
> what I want is before the crud.delete to ask whether the user really
> wanted to delete. Is there some way to put up a confirmation dialog in
> the delete action? The framework puts the logic for it in the view of
> course, but I'd like to avoid the 2-step process of checkbox, then
> submit. Instead I'd like a Delete button, then a confirmation.

Reply via email to