I came across the same issue recently and managed to solve it as follows:-

 

lambda row: A(SPAN('Delete', _class="button btn btn-info btn-sm", 
_title='Delete', _onclick = "return confirm('Are you sure?');"), \

                             _href=URL("default", 
"delete_company",args=[row.id])),

           

This will give you the standard pop confirmation box with customised text.

 

Hope this helps.

From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: 02 May 2019 21:58
To: web2py-users
Subject: [web2py] Confirmation forms. The book is unclear. How can I associate 
a pop confirmation box with a link?

 

This has been asked before but I can't find any usable answers, at least for 
those who aren't experts on css and javascript.

 

Tried to do something along the lines suggested in the book 'Forms and 
Validators/Confirmation Forms' without any success. Either I'm stupid or this 
feature is broken or the explanation is incomplete/unhelpful.

 

Actually, my problem is a bit different. I am using SQLFORM.grid and 
.smartgrid, with additional links specified. On one of these links I would like 
to have a confirming Yes/No when the link is clicked, before following the 
link. It almost looks in the documentation if this could be done using the A() 
helper, but I can't figure it out. My link is a replacement for the standard 
Delete button because there is other stuff that needs to be done BEFORE the 
deletion is performed, rather than after via ondelete.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to