Using web2py 2.12.2 with formstyle = bootstrap3_inline Problem: When displaying a SQLFORM with readonly=True the field labels and values do not line up horizontally. I have a screen image, but the following gives you an idea of what it looks like...
Bob First Name # without fix (Note that the misalignment is exaggerated here..) I added 2 lines of code (see "#bob's fix" below) to 'formstyle_bootstrap3_inline_factory' in gluon/sqlhtml.py which solved this misalignment. First Name Bob # with fix 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') elif isinstance(controls, SPAN): _controls = P(controls.components, _class="form-control-static %s" % col_class) elif isinstance(controls, UL): for e in controls.elements("input"): e.add_class('form-control') # bob's fix elif controls is None or isinstance(controls, basestring): _controls = P(controls, _class="form-control-static %s" % col_class) # end bob's fix if isinstance(label, LABEL): label['_class'] = 'control-label %s' % label_col_class parent.append(DIV(label, _controls, _class='form-group', _id=id)) return parent return _inner -- 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.