Okay... I installed your version and took a look at what was going on. I am a little confused about a couple of things:
In the controller: @auth.requires_login() def toggle_attendance(): """ This is where a user can toggle attendance to any event displayed on the 'tonight. page. """ event_id = request.args(0) if db((db.attendance.event==event_id) & (db.attendance.user==auth.user.id)).delete(): return 'You are attending this event' else: db.attendance.insert(event=event_id, user=auth.user.id) return 'You are not attending this event' This obviously works but looks backwards to me for some reason. What am I missing? In the view: <button id="x{{=item.event.id}}"onclick="ajax( '{{=URL(r=request,f='toggle_attendance', args=item.event.id)}}',[],'x{{=item.event.id}}');"> Can you step me through what is going on here. I'm not sure I understand how the helpers work with ajax. I get that you are creating a 'button' and that it is passing the event.id to the toggle function. I guess my confusion is still the confusion about how the toggle is deciding what to return. It seems like if it successfully deletes the attendance record, it returns that there IS an attendance, and if it inserts an attendance record it returns that is NOT an attendance. This is not what actually happens so why am I reading it this way? I also don't understand where what is actually returned is represented in the view. Thanks for your help On Aug 10, 5:22 pm, __future__ <wrigh...@gmail.com> wrote: > Thanks. > > On Aug 10, 2:33 pm, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote: > > > @__future__ > > > I made some improvements using a LEFT join in tonight and "attending/ > > not attending" using AJAX. > > > Massimo > > > events.zip > > 3KViewDownload > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---