The radiowidget function returns 
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L384

parent(*opts, **attr)

so the kargs solution of Richard works but not when style is 'divs' because 
the parent is 'CAT' 
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L364 and 
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L366

The same happens for the checkboxeswidget.

Some time ago I opened an issue on this matter (
https://code.google.com/p/web2py/issues/detail?id=1821) but only the first 
problem was corrected. 
Maybe we should open another issue ticket. What do you think?


Il giorno lunedì 6 gennaio 2014 20:27:15 UTC+1, Richard ha scritto:
>
> Or you will have to create a custom widget... You can grab the 
> radio.widget in /gluon/sqlhtml.py ans search for RadioWidget class...
>
> You can turn it into a method with the help of the book.
>
> But the kargs above should work as far as I can see look at the code of 
> the RadioWidget...
>
> Richard
>
>
> On Mon, Jan 6, 2014 at 2:24 PM, Richard Vézina 
> <ml.richa...@gmail.com<javascript:>
> > wrote:
>
>> You can try this :
>>
>> **{'_class': 'radio'}
>>
>> As a kargs...
>>
>> Richard
>>
>>
>> On Mon, Jan 6, 2014 at 1:53 PM, Annet <anne...@googlemail.com<javascript:>
>> > wrote:
>>
>>> I have the following field definition in a table:
>>>
>>> Field('title', length=8, requires=IS_IN_SET(['Mr', 'Mrs'. 'Ms']), 
>>> widget=lambda k,v: SQLFORM.widgets.radio.widget(k, v, style='divs')),
>>>
>>> I would like to style the radio widget, but adding _class='radio' to the 
>>> widget function does not add a class attribute to the divs.
>>> Is there a way to add this class?
>>>
>>> Kind regards.
>>>
>>> Annet
>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to