Thanks Massimo, It's GREAT to know that web2py can do that, but I thought I should learn about passing variables between python and web2py using JavaScript.
On Mon, Jul 6, 2009 at 4:53 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > hey... web2py does this automatically if you use an input checkbox > with class="delete". No JS needed. > > Massimo > > On Jul 6, 3:57 pm, NetAdmin <mr.netad...@gmail.com> wrote: > > Hello All, > > > > I'm trying to display records in a table, that has a button at the end > > of each row, that calls a JavaScript popup to confirm the delete. > > > > I'm stuck and would appreciate any help anyone can offer. > > > > Some of the code is attached. > > > > Thanks! > > > > Sterling > > > > <head> > > <script type="text/javascript"> > > <!-- > > function confirmation() { > > var answer = confirm("Delete Record?") > > // how can I pass the record ID from python to javascript? > > // I tried something like ... recno = "{{=r.id}}" > > recno = '48' > > if (answer){ > > // delete the specified record number > > alert("Deleting Record Number# " + recno ) > > window.location = "http://IP-ADDRESS:8000/appname/ > > controller/delete/" + recno; > > } > > else{ > > alert("The record was NOT deleted") > > }} > > > > //--> > > </script> > > </head> > > > > {{# tboffice.id tboffice.fdesc tboffice.fprice }} > > <table> > > {{ for r in recs: }} > > {{ price = '%.2f' % r.fprice }} > > {{ rec_id = '%04i ' % r.id }} > > {{ d = r.fdesc }} > > <tr> > > <td> {{=rec_id}} </td> <td> {{=r.fdesc}} </td> <td align="right"> > > {{=price}} </td> <td> {{=LI(A("Delete", _href=URL(r=request , > > f="delete/"+str(rec_id) ))) }} </td> <td> <form> <input type="button" > > onClick="confirmation()" value="Delete"> </form> </td> > > </tr> > > {{pass}} > > </table> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---