Ah, I see that my 'checkbox' is actually this widget by default:

SQLFORM.widgets.boolean.widget

So then it's in fact the boolean.widget that isn't being correctly styled.

Still trying to work out where the styling for boolean.widget comes from. 

Still think it's something that will be relvealed by sqlhtml.py , but not 
nailed it yet.

At least now I know which widget my form is using.

It has consistent styling in the stacked formstyle, just not in the inine 
formstyle.



On Wednesday, 4 November 2015 14:52:39 UTC, Richard wrote:
>
> In the book it mention that radio and checkboxes widget have different 
> style attribute, your issue is probably related to this particularity of 
> these widget ?
>
> Quote from the book :
> Widgets are helper factories and their first two arguments are always 
> field and value. The other arguments can include normal helper attributes 
> such as _style, _class, etc. Some widgets also take special arguments. In 
> particular SQLFORM.widgets.radio and SQLFORM.widgets.checkboxestake a 
> style argument (not to be confused with _style) which can be set to 
> "table", "ul", or "divs" in order to match the formstyle of the 
> containing form.
>
> On Wed, Nov 4, 2015 at 2:27 AM, Gary Cowell <gary....@gmail.com 
> <javascript:>> wrote:
>
>> That the labels for boolean fields are consistent in appearance with the 
>> labels for other classes of field.
>>
>> So, emboldened and on the left. 
>>
>> On Tuesday, 3 November 2015 16:28:15 UTC, Richard wrote:
>>>
>>> What is the expected behavior?
>>>
>>> On Tue, Nov 3, 2015 at 4:50 AM, Gary Cowell <gary....@gmail.com> wrote:
>>>
>>>> Web2py version:
>>>> >>> import gluon.widget
>>>> >>> print gluon.widget.ProgramVersion
>>>> Version 2.12.3-stable+timestamp.2015.08.19.00.18.03
>>>>
>>>>
>>>> When using bootstrap3_inline for forms, the checkbox lables are not 
>>>> correctly styled:
>>>>
>>>>
>>>>
>>>>
>>>> This is my form code:
>>>>
>>>>     form=SQLFORM.factory(
>>>>         Field('SystemName',label='System Name', length=80, required=
>>>> True, requires=IS_NOT_EMPTY()),
>>>>         Field('Image',label='Base System', requires=IS_IN_SET(imageList
>>>> ,zero='Choose Base System')),
>>>>         Field('Customer',label='Customer', requires=IS_IN_DB(dbcccs,
>>>> dbcccs.v_clients.cc_customer_id,'%(cc_name)s (%(cc_customer_id)s)',zero
>>>> ='Choose Customer')),
>>>>         Field('publicsystem','boolean',label='Public', default='False'
>>>> ),
>>>>         Field('customports','boolean',label='Custom Ports?', default=
>>>> 'False'),
>>>>         Field('customportlist',label='Custom Port List', required=False
>>>> , requires=IS_MATCH('^(\d+(,\d+)*)?$', error_message="Comma delimited 
>>>> port list, e.g. 5001,5050,9127")),
>>>>         formstyle='bootstrap3_inline'
>>>>     )
>>>>
>>>>
>>>> And this code looks suspicious in gluon/sqlhtml.py:
>>>>
>>>> def formstyle_bootstrap3_inline_factory(col_label_size=3):
>>>>     """ bootstrap 3 horizontal form layout
>>>>
>>>>     Note:
>>>>         Experimental!
>>>>     """
>>>>     def _inner(form, fields):
>>>>         form.add_class('form-horizontal')
>>>>         label_col_class = "col-sm-%d" % col_label_size
>>>>         col_class = "col-sm-%d" % (12 - col_label_size)
>>>>         offset_class = "col-sm-offset-%d" % col_label_size
>>>>         parent = CAT()
>>>>         for id, label, controls, help in fields:
>>>>             # wrappers
>>>>             _help = SPAN(help, _class='help-block')
>>>>             # embed _help into _controls
>>>>             _controls = DIV(controls, _help, _class=col_class)
>>>>             if isinstance(controls, INPUT):
>>>>                 if controls['_type'] == 'submit':
>>>>                     controls.add_class('btn btn-primary')
>>>>                     _controls = DIV(controls, _class="%s %s" % (
>>>> col_class, offset_class))
>>>>                 if controls['_type'] == 'button':
>>>>                     controls.add_class('btn btn-default')
>>>>                 elif controls['_type'] == 'file':
>>>>                     controls.add_class('input-file')
>>>>                 elif controls['_type'] in ('text', 'password'):
>>>>                     controls.add_class('form-control')
>>>>                 elif controls['_type'] == 'checkbox':
>>>>                     label['_for'] = None
>>>>                     label.insert(0, controls)
>>>>                     _controls = DIV(DIV(label, _help, _class="checkbox"
>>>> ),
>>>>                                     _class="%s %s" % (offset_class, 
>>>> col_class))
>>>>                     label = ''
>>>>                 elif isinstance(controls, (SELECT, TEXTAREA)):
>>>>                     controls.add_class('form-control')
>>>>
>>>> The checkbox control type is doing something odd with labels.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> 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.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> 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/d/optout.
>>
>
>

-- 
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/d/optout.

Reply via email to