Thanks for the idea Dereck

Appreciate your help too Paolo!

Richard

On Tue, Nov 13, 2012 at 6:48 PM, Derek <sp1d...@gmail.com> wrote:

> I'd use a before_delete function to check if the checkbox 'yes im sure -
> delete' was checked. if not checked, don't delete. don't enable the delete
> button until that box is checked is another option
>
>
> On Tuesday, November 13, 2012 1:26:08 PM UTC-7, Richard wrote:
>>
>> 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<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