Re: [web2py] pre selected checkboxes

2012-07-11 Thread Richard Vézina
Ok Fabiano, no issue with SQLFORM.widgets.checkboxes.widget... I didn't know exactly how it works :) In this thread look for Bruno's answers that how I figure out how to pass the proper default to widget : https://groups.google.com/forum/?fromgroups#!searchin/web2py/%5Bweb2py%5D$20requires$20and$

Re: [web2py] pre selected checkboxes

2012-07-11 Thread Richard Vézina
Fabiano, I think there is an issue with widget=SQLFORM.widgets.checkboxes.widget do you use it? I try without widget=SQLFORM.widgets.checkboxes.widget and I can set default=True and I get a checked box, but if I use it the box doesn't get checked. If you don't need the fancy feature of widget (I

Re: [web2py] pre selected checkboxes

2012-07-11 Thread Fabiano Faver
the field is shown if I dont declare the type, however the checks are not checked with default=True, like I wrote Em quarta-feira, 11 de julho de 2012 07h35min46s UTC-3, villas escreveu: > > Don't you need a list field type for 'usuarios'? > > > On Tuesday, July 10, 2012 9:49:40 PM UTC+1, Fabiano

Re: [web2py] pre selected checkboxes

2012-07-11 Thread villas
Don't you need a list field type for 'usuarios'? On Tuesday, July 10, 2012 9:49:40 PM UTC+1, Fabiano Faver wrote: > > controller: > > def gerenciar_grupos(): > > form_not_usu = SQLFORM.factory( > Field('usuarios', requires=IS_IN_DB(db, > db.auth_user,'%(email)s',multiple=True),widget=SQLFORM.wid

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
controller: def gerenciar_grupos(): form_not_usu = SQLFORM.factory( Field('usuarios', requires=IS_IN_DB(db, db.auth_user,'%(email)s',multiple=True),widget=SQLFORM.widgets.checkboxes.widget, default=True), ) return dict( form_not_usu = form_not_usu) view: {{

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Richard Vézina
default=lambda row: row.check_box_field Richard On Tue, Jul 10, 2012 at 4:03 PM, Fabiano Faver wrote: > Won`t it apply True to all of them? > > this is what I have now with sqlform: > > Field('users', requires = IS_IN_DB(db, db.auth_user, '%(email)s', > multiple=True), widget=SQLFORM.widgets.ch

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
Won`t it apply True to all of them? this is what I have now with sqlform: Field('users', requires = IS_IN_DB(db, db.auth_user, '%(email)s', multiple=True), widget=SQLFORM.widgets.checkboxes.widget ) I imagined there were a argument using lambda that would set 'checked' for each checkbox t

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Richard Vézina
in your model Field(..., default=True) or in the controller db.table.field.default=True You also need to use checkbox widget. Richard On Tue, Jul 10, 2012 at 2:39 PM, Fabiano Faver wrote: > I want to creat something similar to SQLFORM(auth_membership) but I want > the user to choose a group an

[web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
I want to creat something similar to SQLFORM(auth_membership) but I want the user to choose a group and all users show up as checkboxes and users who already belong to this group are checked as well. I`m downt know how to pre-select these auth_users. any tips?