In web2py, each request runs only one action from a controller -- from 
within a view, you do not call other controller actions. If you want to 
display a form within a given page, you should create and return the form 
within the action for that page. If you need to re-use the code for the 
form, you can define a separate function to create the form and then simply 
call it from the main page's action.

As an alternative, if you do really need to compose a single page from 
multiple separate re-usable actions, you can use 
components<http://web2py.com/books/default/chapter/29/12#Components>
.

Anthony

On Friday, January 18, 2013 2:06:17 AM UTC-5, Alex Glaros wrote:
>
> The example at http://web2py.com/books/default/chapter/29/07#SQLFORMshows 
> this function below. But what is the syntax for calling a function 
> from a view?
>
> Would it be this?  {{=display_form()}}
>
> thanks,
>
> Alex Glaros
>
>
> def display_form():
>    form = SQLFORM(db.person)
>    if form.process().accepted:
>        response.flash = 'form accepted'
>    elif form.errors:
>        response.flash = 'form has errors'
>    else:
>        response.flash = 'please fill out the form'
>    return dict(form=form)
>
>
>
>
>

-- 



Reply via email to