how to update a table based on checkbox-selection?

47 views
Skip to first unread message

Timmie

unread,
May 18, 2009, 12:23:48 PM5/18/09
to web2py Web Framework
Hello,
I want to achieve the following:

* Show all records or a search result of records as a table.
* The first column of the table shall contain a checkbox.
* The usere shall select those records, he/she is interested in by
checking the boxes
* The user shall click on: show details for selected which would
update the selection accordingly.

I found this PHP code:
http://www.webbysoft.com/babelkit/php/bk_demo.php

How would I start to develop such a functionality with web2py?

Thanks,
Timmie

mdipierro

unread,
May 18, 2009, 1:12:33 PM5/18/09
to web2py Web Framework

def do_what_timmie_asks():
rows=db(db.sometable.id>0).select()
db.sometable.id.represent=lambda id: DIV(id,INPUT
(_type='checkbox',_name='check%i'%id))
form=FORM(SQLTABLE(rows),INPUT(_type='submit'))
if form.accepts(request.vars):
pass # or so something not sure what you want to do
return dict(form=form)

Tim Michelsen

unread,
May 18, 2009, 3:24:21 PM5/18/09
to web...@googlegroups.com
> def do_what_timmie_asks():
Made me laugh ;-)

Sorry, for posting that many questions.
I did some testing / design. And these issues came up.

mdipierro

unread,
May 18, 2009, 5:10:49 PM5/18/09
to web2py Web Framework
No problem at all. This is a place for asking questions. The more the
better. I do what I can to keep up.

Massimo
Reply all
Reply to author
Forward
0 new messages