``web.input()`` contains the data from a request. You can let the form
extract the data from the form by feeding it the request data like so:
form = your_form(web.input())
http://webpy.org/cookbook/input
On Wed, Sep 29, 2010 at 2:09 PM, boubou_cs <[email protected]> wrote:
> Hello, I encounter a problem with the forms:
> is my code correct? I can not recover the values sent for each form :
>
> My test.py:
>
> import web
> from web import form
>
> urls = ('/', 'Page')
>
> app = web.application(urls, globals())
>
> render = web.template.render('')
>
>
> class Page:
> """ """
> form_na = form.Form(
> form.Textbox('name', size=30, description="Name:"),
> form.Textbox('prename', size=30, description="Prename:"),
> form.Button('Send 1') )
> form_ip = form.Form(form.Textbox('ip', size=45, description="IP :"),
> form.Button('Send 2') )
>
> def GET(self):
> """ """
> form1 = self.form_na()
> form2 = self.form_ip()
> return render.Page(form1, form2)
>
> def POST(self):
> """ """
> form1 = self.form_na()
> form2 = self.form_ip()
>
> return "Results form1: %s %s\nResults form2 : %s" %
> (form1.d.name, form1.d.prename, form2.d.ip)
>
> if __name__ == "__main__":
> app.run()
>
> My Page.html:
>
> $def with (form1, form2)
> $if form1:
> <form action="" method="post">
> $:form1.render()
> </form>
> $if form2:
> <form action="" method="post">
> $:form2.render()
> </form>
>
> Thanks for your help !
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>
--
Branko Vukelić
[email protected]
[email protected]
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.