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 think that it is mostly to
have many checkboxes for the same field and specify labels for those
multiple checkboxes) avoid using it could solve your issue.

I will investigate further why and how SQLFORM.widgets.checkboxes.widget
could be broken.

Richard

On Wed, Jul 11, 2012 at 1:50 PM, Fabiano Faver <[email protected]> wrote:

> 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 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.**widgets.checkboxes.widget,
>>> default=True),
>>>                                 )
>>> return dict(  form_not_usu = form_not_usu)
>>>
>>>
>>>
>>> view:
>>>
>>> {{extend 'layout.html'}}
>>> {{=form_not_usu.custom.begin}}
>>>
>>> <ul>
>>> {{for x in form_not_usu.custom.widget.**usuarios:}}
>>> {{=LI(x)}}
>>>
>>> {{pass}}
>>> </ul>
>>>
>>> {{=form_not_usu.custom.submit}**}
>>> {{=form_not_usu.custom.end}}
>>>
>>>
>>>
>>> Checkboxes are not checked when accessing the page.
>>>
>>> Em terça-feira, 10 de julho de 2012 16h46min48s UTC-3, Richard escreveu:
>>>>
>>>> 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 <[email protected]>wrote:
>>>>
>>>>> 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?
>>>>>
>>>>
>>>>

Reply via email to