That definitely works and I've done it like that a couple times, but then I'm defining the input fields in two separate places.
I'm thinking that maybe I have a custom view function that can take a vanilla form and then add my styling to it automatically. If I only had to do a few forms it wouldn't be a big deal but I want to try and keep the duplication as minimal as possible. On Saturday, October 6, 2012 6:18:49 PM UTC-4, Anthony wrote: > > Just use > SQLFORM.factory<http://web2py.com/books/default/chapter/29/07#SQLFORM.factory>in > the controller to define the form fields, and then build the form > manually in the view (possibly using some of the > form.custom<http://web2py.com/books/default/chapter/29/07#Custom-forms>items). > > Anthony > > On Saturday, October 6, 2012 2:07:49 PM UTC-4, Austin Cormier wrote: >> >> So I have the following customer form defined in my view for prototyping: >> >> form = FORM(FIELDSET(DIV(LABEL('Email Address', >> _class="control-label"), >> DIV(INPUT(_class="input-large", _id="email", >> _name='email', >> requires=IS_NOT_EMPTY()), >> _class="controls"), >> _class="control-group"), >> DIV(DIV(BUTTON("Add Email", _type='submit', >> _class="btn"), >> _class="controls"), >> _class="control-group"), >> >> >> _class="gebo"), >> _class="form-horizontal") >> >> The issue is that I need to define the form in the controller so that I >> can run through the form accept (don't want to do that in the views). Even >> though I'm doing this in the controller, I would like the view to be >> responsible for styling the form. Are there any useful techniques anyone >> knows of so that I can do this in a reusable and maintainable way across my >> application? >> > --