Is there an easy way to reposition the labels for checkboxes? I would like to show them on the left side in the same way as the other controls.
Thank you Tim for your answer. That told me everything I needed to know. Here is what I had to do:
Find the relevant function in the gluon\sqlhtml.py
. For me it was formstyle_bootstrap4_inline_factory
Copy the _inner
function which is in the formstyle_boostrap4_inline_factory
function into my application and rename it formstyle_myapp
(putting it in a model file is probably the easiest)
Copy the add_class
function from gluon.sqlhtml
and add it into formstyle_myapp
function. This makes it visible to formstyle_myapp
only.
Change the default formstyle
setting in db.py to point to the new function: response.formstyle = formstyle_myapp
Finally, adjust the checkbox part of the formstyle_myapp
to position the label on the left under all the other labels and the checkbox to the right under all the the other controls:
elif controls['_type'] == 'checkbox' or controls['_type'] == 'radio':
_controls = DIV(controls, _class="%s" % col_class)