[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Anthony
On Tuesday, May 17, 2016 at 5:10:25 AM UTC-4, Vic Ding wrote: > > Strange enough. Found the code which is generating the 404 problem. > > If I use crud. The record will be removed, but a 404 error to > default/removeProduct error will raise. > > crud.delete(db.product, productid) > > > If I use

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Anthony
On Tuesday, May 17, 2016 at 4:31:52 AM UTC-4, Vic Ding wrote: > > BTW, the following line is enough to trigger the remove function and > removal of the designated DIV, extra js to remove the div in the remove > function is not necessary. > Correct -- the "delete" argument to the A() helper hand

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
Strange enough. Found the code which is generating the 404 problem. If I use crud. The record will be removed, but a 404 error to default/removeProduct error will raise. crud.delete(db.product, productid) If I use delete, everything works fine. but I do not get the flash confirmation "recor

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
BTW, the following line is enough to trigger the remove function and removal of the designated DIV, extra js to remove the div in the remove function is not necessary. A('delete', callback=URL('product', 'removeProduct', args=str(row.id)), delete='div#product' + str(row.id)) The c

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-17 Thread Vic Ding
Found it! in the removeProduct.html (the view), I used to print out some debug information, those variables are removed recently. This caused the 500 internal error and prevent the javascript from running. It is still interesting how the 500 internal error on "non-existing" variable leads to 40

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Anthony
On Monday, May 16, 2016 at 4:15:53 PM UTC-4, Vic Ding wrote: > > This is the XHR > invalid function (default/removeProduct) > > > That's not a 200 response, so it will not trigger the DIV removal. > The removeProduct function is located under product.py not default. > Then your URL is incorrec

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
This is the XHR invalid function (default/removeProduct) The removeProduct function is located under product.py not default. This is the strange part for me, the ajax call to product/removeProduct/pid is successful as the database record is indeed removed. However, there is such an invalid call

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Anthony
Can you show the network requests? If the XHR doesn't return successfully (regardless of whether the record is deleted), the Javascript to remove the DIV will not be triggered. Anthony On Monday, May 16, 2016 at 3:15:54 PM UTC-4, Vic Ding wrote: > > HI Anthony, > > There is one mysterious 404 t

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Vic Ding
HI Anthony, There is one mysterious 404 to the remove function, to a wrong URL which I never called. However, the record is indeed successfully removed from database. On Monday, May 16, 2016 at 8:35:50 PM UTC+2, Anthony wrote: > > Your original code works for me. Are you sure the Ajax reques

[web2py] Re: html helper A with delete attribute not working, the div is not removed

2016-05-16 Thread Anthony
Your original code works for me. Are you sure the Ajax request is returning successfully (check the browser developer tools and make sure the XHR request returns with a 200 response)? Also, check for any errors in the Javascript console. Anthony On Sunday, May 15, 2016 at 11:49:34 AM UTC-4, Vi