El Wed, 21 May 2014 03:01:46 -0700 (PDT)
Maurice Waka <[email protected]> escribió:
>
>
> When I iterate through the controller as this:
>
> def return_post:
> form = SQLFORM(db.post)
> for c in form:
> form1= post.body
> form2 = form1.split()return dict(form2=form2)
>
> I get an error that form2 is not defined in the view{{=form2}}.
>
> How do i define this form2?
>
Not very clear to me, calling SQLFORM to form woul create a new post
form, so it is empty. But here you have a syntax error:
form1= post.body
must be
form1= c.post.body
if you want to show the actual posts you should do something like:
def return_post():
form=db(db.post.id>0).select()
return dict(form=form)
and in the view only show the body field:
{{for c in post:}}
{{=c.body}}
{{pass}}
or... could you explain a little more about the problem.
Marco.
--
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.