Well, SQLFORM doesn't really provide a complete separation between
controller and view (i.e., you typically end up specifying some display
related parameters in the controller). You can do some manipulation of the
form object in the view via the server side DOM. For example:
{{form['_class'] = 'form-horizontal bucket-form'}}
{{=form}}
Anthony
On Monday, February 17, 2014 3:39:00 AM UTC-5, Juslin Guo wrote:
>
> Hi All,
>
> I making the switch from cakephp to web2py, one of the things i struggle
> with is the form module... Is there a way i could override it without
> having to touch the controller.
>
> This requires the controller to know the css class..
> form = SQLFORM(db.post,_class="form-horizontal bucket-form",
> formstyle='bootstrap')
>
> Another method of course is using the custom.widget... but it is kind of
> cumbersome, when you fields come up to 20-30 fields
>
> <div class="form-group">
> <label class="col-sm-3
> control-label">Name</label>
> <div class="col-sm-6">
> {{form.custom.widget.author['_class'] =
> 'form-control'}}
> {{=form.custom.widget.author}}
> </div>
> </div>
>
> Is there a more elegant way to do this?
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.