I believe this line 
<https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L1499> in 
sqlhtml.py is disturbing the way formstyle_bootstrap displays custom 
widgets:

parent.components = [widget]


The older formstyles (table3cols, table2cols, etc) all wrap their 
controls within a dedicated tag, for example:

_controls = TD(controls, ...)
...
table.append(TR(_label, _controls, _help, _id=id))


In contrast, formstyle_bootstrap puts a help span as a *sibling* to the 
controls:

_help = SPAN(help, _class='help-block')
_controls = DIV(controls, *_help*, ...)
...
parent.append(DIV(label, _controls, ..., _id=id))


The result is that, when the form is submitted but has errors, i.e.:

   - form.accepts(...) returns False, and
   - fieldname is in request_vars,

the DIV which contained controls and _help now only contains the widget. 
The styling applied in formstyle_bootstrap is also lost, e.g.:

controls.add_class('span4')


A partial fix might be to wrap the controls in a redundant SPAN in 
formstyle_bootstrap:

_controls = DIV(SPAN(controls), _help, ...)

although this would not fix the styling problem.

Is this bug fixable while maintaining backward compatibility? Is there a 
fundamental impedance mismatch between the web2py and boostrap approaches 
to form layout? I have worked around the problem in my project to some 
extent with a custom formstyle, but am still affected by the styling 
problem.

Thanks for an otherwise glorious framework.

Regards,
Jeremy Field

-- 
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