| | 45 | You can also customize the styling and classes used in forms using formstyle. Add this to config.py (in config() function if using the new template location): |
| | 46 | |
| | 47 | {{{ |
| | 48 | settings.ui.formstyle = "your_formstyle" |
| | 49 | }}} |
| | 50 | |
| | 51 | Formstyles can be: table2cols, table3cols, divs, bootstrap, foundation and many more. You can find these functions in web2py/gluon/sqlhtml.py with the names "formstyle_<something here>". You can refer to these to implement custom functions. The settings.ui.formstyle can also take a function. And example function to use Semantic UI form styling: |
| | 52 | |
| | 53 | {{{ |
| | 54 | def semantic_formstyle(id, label, controls, help): |
| | 55 | """ divs only """ |
| | 56 | _help = DIV(help, _class='w2p_fc') |
| | 57 | _controls = controls |
| | 58 | _label = LABEL(label) |
| | 59 | return DIV( |
| | 60 | _label, |
| | 61 | _controls, |
| | 62 | _help, |
| | 63 | _id=id, |
| | 64 | _class="ui field" |
| | 65 | ) |
| | 66 | }}} |
| | 67 | |
| | 68 | |