I'd just like to point out, that couldn't he also do this:
return dict(form2=form2, form1=form1)
then in the view you can have this:
{{=form1}} {{=form2}}
On Friday, January 18, 2013 10:04:22 AM UTC-7, Anthony wrote:
>
> If you go to the URL /yourapp/default/index, when the index.html view is
>
If you go to the URL /yourapp/default/index, when the index.html view is
executed, it will only have available to it whatever is returned by the
index() function in the default.py controller. If you want to display the
form created in the display_form() action, you have to create a
/views/defau
you're two or more steps ahead than your brain
def display_form():
in a controller named "thecontroller.py"
will work ok as long as in a view
views/thecontroller/display_form.html
there's a
{{=form}}
written inside.
If you want to copy/paste examples in the book at least read the
I (1) created the "person" table in models, (2) typed in the function
displayed in my original post in the controller, then (3) inserted
{{=form}} in /views/default/index.html but receive this error:
name 'form' is not defined
I'm just trying to make the example in the documentation work so tha
Hi Alex,
it is exactly that form, the one returned in the dictionary by the
display_form function.
There is nothing wrong with other functions returning the same variable
unless you use them in the same view.
Normally each function has its own view.
Denes
--
Also, it might help if you indicate what you are trying to do.
Anthony
On Friday, January 18, 2013 9:57:23 AM UTC-5, Anthony wrote:
>
> SQLFORM names the form based on the name of the db table (as well as the
> type of form -- create or update). If you have multiple forms on the page,
> their n
SQLFORM names the form based on the name of the db table (as well as the
type of form -- create or update). If you have multiple forms on the page,
their names will not conflict unless they are based on the same db table,
and in that case, you can specify your own unique form names via the
"for
a controller can contain multiple function, each one of them can have a
return dict(afixedname=avalue) . when you use an url like
/app/controller/display_a_form or /app/controller/display_a_form2 you may
return the same dict with the same keys for both, the values are the one
that will be d
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,
Thanks Denes,
but it seems that "form" doesn't uniquely identify anything, or is the "return
dict(form=form)" the part that gives the output a unique name?
I mean would other functions in the same controller have syntax to give
distinguishing names such as
"return dict(form2=form2)", and "re
Hi Alex,
you can't call the function from the view, you would have to pass it
somehow or re-define it there, but the question is why?.
Normally you would just write {{=form}} in the view to display the form
returned form the function.
Regards,
Denes
--
11 matches
Mail list logo