I do something similar except I use request.args(0) and look for "yes".
If it has it delete otherwise show a screen with a "du ya reelize wanna"
and a no with goes to some page, and yes which just adds a /yes to the
end. IF there is yes, delete AND redirect to a page somewhere...
BR,
J
On 10/02/2010 01:14 AM, mdipierro wrote:
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.