Have you looked 
at http://web2py.com/books/default/chapter/29/7#Custom-forms 
and http://web2py.com/books/default/chapter/29/7#Custom-forms. Note, in the 
latter case, if you want CSRF protection, you'll also need to add the 
hidden _formkey field in addition to the _formname field.

Anthony

On Friday, March 2, 2012 1:03:37 PM UTC-5, fabien wrote:
>
> Hello, 
>
> I'm writing my first non-trivial web2py application, and I have a hard 
> time keeping my HTML boilerplate in views rather than in controllers. 
>
> More specifically, some of my FORMs feature a lot of fancy markup + 
> javascript.  Since they deal mostly with HTML, I'd rather put them in 
> HTML view templates; but I need to access them from the controller, to 
> perform the "form.accepts()" validation tests. 
>
> Is there a reasonable / preferred way to handle a FORM's lifecycle 
> (validation + handling of the POST request) in the controller, while 
> keeping its HTML content mostly in the view template? 
>

Reply via email to