On Sunday, February 8, 2015 at 5:51:15 AM UTC+1, Massimo Di Pierro wrote:
>
> Now the fact that one can use them in controllers does not mean one should
> do that.
>
But the FORM helper is extensively used in the controllers in the web2py
manual. And complex forms usually contain tables, or may be laid inline
with bootstrap, or have buttons or other controls which improve if you add
the css classes, so I end up using helpers in the controllers more than
what the canon seems to recommend. Workarounds like using custom forms
seems to be very verbose, harder to read and less documented. What is the
canonical way to turn a sample form like this one in the manual:
form=FORM('Your name:', INPUT(_name='name'), INPUT(_type='submit'))
into a real-world bootstrap-compatible form:
form=FORM(LABEL('Your name:', _for='name'), INPUT(_name='name', _class=
'form-control', _placeholder='Name Surname'), INPUT(_type='submit', _class='btn
btn-primary'))
I'm gradually wrapping complex views into new helpers, and placing them
inside modules. But I have code like the above all over my app: What's the
web2py best practice?
Regards
--
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/d/optout.