Also, if you want to take advantage of the SQLFORM functionality, but your form is not based on a database table, you can use SQLFORM.factory. See http://web2py.com/book/default/chapter/07#SQLFORM.factory. Anthony
On Thursday, July 7, 2011 3:27:51 PM UTC-4, Anthony wrote: > No, formstyle is not an option with the FORM helper. The FORM helper simply > generates the opening and closing form tags: > > >>> print FORM() > <form action="" enctype="multipart/form-data" method="post"></form> > > > If you want to use the FORM helper, you'll have to figure out the > appropriate HTML/CSS to generate the layout you want within the form tags. > To see how SQLFORM generates table-based forms, you can look at the source > code: > > - Individual field input widgets and labels are generated in this for > loop of the __init__ method: > http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#727 > - The field widgets are then inserted into a table, divs, or unordered > list (depending on the formstyle chosen) in the createform() method: > http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#904 > > Anthony > > On Thursday, July 7, 2011 2:09:30 PM UTC-4, Jim S wrote: > >> Hi >> >> Looking for help with form generation. I have: >> >> form = FORM(LABEL('Name', _for='permissionName'), >> INPUT(_type='text', __name='permissionName', >> _id='permissionName', >> _style="width:150px;", _class='listPanelRow'), >> LABEL('Table', _for='tableName'), >> INPUT(_type='text', __name='tableName', >> _id='tableName', >> _style="width:150px;", _class='listPanelRow'), >> INPUT(_type='submit', _value='Add'), >> _id='permissionForm', >> formstyle='table2cols') >> >> I want my form to display with the label above the input field. The above >> code is producing a form with the label ahead of the input field. I know >> that formstyle is supported for SQLFORM, but is it available in just the >> FORM helper as I'm trying to use it here? >> >> Thanks >> >> -Jim >> >> >>