Thanks pbreit! I'm trying to user your code but nothing happens... It shows
the list with the link, but when I click the link nothing happens, no
errors, no changes.

Couldn't be easiest if I do it with checkboxes??? (I don't really know how)

On Tue, Apr 12, 2011 at 4:30 PM, pbreit <pbreitenb...@gmail.com> wrote:

> I almost never advise an Ajax solution first but this might be a reasonable
> way to go. This will work for 10s of rooms but probably not 100s since you
> have to click once to verify each room. You can choose whatever statuses you
> want. I have it so that it becomes "verified" when you click the link.
>
> === db.py ===
> db.define_table('room',
>     Field('name'),
>     Field('status'))
>
> === default.py ===
> def index():
>     rooms = db(db.room.id>0).select()
>     return dict(rooms=rooms)
>
> def update_status():
>     room = db(db.room.id==request.vars.id).select().first()
>     room.update_record(status='verified')
>     return room.status
>
> === index.html ===
> {{extend 'layout.html'}}
> <form><input type="hidden" id="id" name="id" value="" /></form>
> <ul>
> {{for room in rooms:}}
>     <li>{{=room.name}} - <a id="room{{=room.id}}" href='#'
> onclick="jQuery('#id').val('{{=room.id}}'); ajax('update_status', ['id'],
> 'room{{=room.id}}');">{{=room.status}}</a></li>
> {{pass}}
> </ul>
>
>
>

Reply via email to