Hello,

I would like to replace the way web2py allow the deletion of a record. 
Instead of the check to delete then confirm then submit... I would add a 
delete buttton on which is attached a confirmation message onclick then 
when the confirmation is confirmed the record is deleted.

Actually I had this :

            form = crud.update(db.table, record)
            form.add_button(T('Delete'), '#', _class='btn-small btn-danger')
            delete_confirmation = T('Are you sure you want to delete this 
record?')
            try:
                form.element('input[value='+T('Delete')+']')['_onclick'] = 
"return confirm ('%s')" % delete_confirmation
            except:
                pass

What I miss is how to actually set form.deleted=true as said in the book (
http://web2py.com/books/default/chapter/29/07#SQLFORM-and-insert/update/delete
)...

I think I need a bit of JS, that detect the confirmation and will submit 
the form.

Am I on the right track?

Richard


-- 



Reply via email to