I would like to have a custom view of login and register forms in my views, without loosing the functionalities of SQLFORM. How can I change the "look" of the forms in views. Please give me some pointers like which CSS file I should be modifying. I donot have knowledge on HTML and CSS, hence I am asking your help.
Thank you so much A thinker :)
First, you can alter the general HTML structure of forms by using the formstyle
argument to SQLFORM
. It takes values, "table3cols", "table2cols", "divs", "ul", "bootstrap", "bootstrap3_stacked", and "bootstrap3_inline", and it can also be a function that generates a custom structure (for an example, see the gluon.sqlhtml.formstyle_bootstrap3_stacked
function). For Auth
forms, you can set the formstyle via the auth.settings.formstyle
setting (see here).
You can modify the CSS for forms however you like. Look here for relevant details. You may also find it useful to generate a form and then examine the generated HTML source code in your browser to understand the structure of the form. If you are using the "welcome" app as your foundation, the relevant CSS files that currently impact form appearance are skeleton.css and web2py.css in /static/css (as of version 1.99.3, which was just released today).
If you need to do more than can be handled via the formstyle
option and CSS changes, then you can create a completely custom form in HTML. See here and here for details.
If you have specific questions as you proceed, feel free to ask for help on the mailing list.