What is the expected behavior?
On Tue, Nov 3, 2015 at 4:50 AM, Gary Cowell <[email protected]> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.