Hi, 1. when I try this I get a: "NameError: global name 'BUTTON' is not defined".
2. In addition I'd like to show the record that is to be deleted: form = crud.read(db.email, request.args(0)) form += FORM('Confirm delete', INPUT(_type='submit')) Is there a way to append to a form? Regards, Andreas balo...@gmail.com On Oct 3, 10:57 am, Jason Brower <encomp...@gmail.com> wrote: > I do something similar except I use request.args(0) and look for "yes". > If it has itdeleteotherwise 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,deleteAND redirect to a page somewhere... > BR, > J > > On 10/02/2010 01:14 AM, mdipierro wrote: > > > The fact iscrud.delete() does not return a form, ever. If you call > > it, it deletes the record. > > > you can do something like this > > > defdelete(): > > 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<tomcampb...@gmail.com> wrote: > > >> I have a 'Delete' link in my edit view. The controller looks like > >> this: > > >> defdelete(): > >> 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 thecrud.deleteto ask whether the user really > >> wanted todelete. Is there some way to put up aconfirmationdialog in > >> thedeleteaction? 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 aDeletebutton, then aconfirmation. > >