You have to give id and name to form inputs, and select needs options. Ttry this on web2py shell
print SELECT(*[OPTION(option, **{"_value": option, "_selected":"selected" if option == 1 else None}) for option in (0, 1)], _name="1", _id="1") <select id="1" name="1"><option value="0">0</option><option selected="selected" value="1">1</option></select> Adapting to your case: {{for row in rows:}} <tr><td>{{=row.descricao}}</td><td>{{=SELECT(*[OPTION(option, **{"_value": option, "_selected":"selected" if option == row.nivel else None}) for option in (0, 1)], _name=row.id, _id=row.id) }} {{pass}} On Wed, Aug 22, 2012 at 5:47 PM, Fabiano Faver <far...@gmail.com> wrote: > I changed the previous model a little: > MODEL: > db.define_table('erro_impressora', > Field('descricao','string'), > Field('nivel', 'integer' ) > ) > > > > Controllers: > > def teste(): > rows = db(db.erro_impressora).select() > return dict(rows=rows) > > def update_nivel(): > for key, value in request.post_vars: > try: > db.erro_impressora[key].update_record(nivel=value) > except: > pass > db.commit() > > redirect(URL('teste')) > > > VIEW: > {{extend 'layout.html'}} > > <form action="{{=URL('update_nivel')}}" method="POST"> > <table> > {{for row in rows:}} > <tr><td>{{=row.descricao}}</td><td>{{= SELECT(0,1, value=row.nivel > ) }} > {{pass}} > <tr><td colspan='2'>{{=INPUT(_type='submit') }}</td></tr> > </table> > </form> > > I`ve done what you suggested but i couldn`t put it to update. action > update_nivel() is receiving a empty request.post_vars > > Em quarta-feira, 22 de agosto de 2012 15h36min52s UTC-3, rochacbruno > escreveu: > >> You can try something like this: >> >> def test(): >> rows = db(db.test).select() >> return dict(rows=rows) >> >> def update_level(): >> for key, value in request.post_vars: >> try: >> db.table[key].update_record(**level=value) >> except: >> # do something if key is invalid. >> db.commit() >> redirect("URL TO REDIRECT AFTER UPDATES") # or use ajax >> >> Now in views/controller/test.html >> >> <form action="{{=URL("update_level")**}}" method="POST"> >> <table> >> {{for row in rows:}} >> <tr> <td>{{=row.name}}</td><td> *<input type="text" value="" id="{{= >> row.id}}" name="{{=row.id}}" />*</td></tr> >> {{pass}} >> </table> >> </form> >> >> >> On Wed, Aug 22, 2012 at 3:16 PM, Fabiano Faver <far...@gmail.com> wrote: >> >>> | name | level | >>> ------------------------------**---- >>> test 1 | combobox(0) | >>> test 2 | combobox(1) | >>> test 3 | combobox(0) | >>> ________ >>> | Submit | >>> ------------- >>> >> >> -- > > > > --