|
Jim
binarybrain at phreaker.net
Sun Feb 15 03:44:49 EST 2004
Thanks to those of you that helped me out. I did get an answer and I
wanted to post it to the list because I don't think the documentation
explains this well.
In my case instead of using util.FieldStorage(req).keys() using the
following worked...
for i in req.form.keys():
html_page.append(req.form[i])
On Sat, 2004-02-14 at 08:52, Jim wrote:
> I am new to modpython and I could use a hand with forms. I currently
> have the publisher setup. The following snippit of code prints none of
> the form vars that I (thought) I was passing. When I click submit test
> gets loaded but the page is blank. I thought iterating through the keys
> would work. What am I doing wrong here?
>
> TIA - Jim
>
> from mod_python import apache, util
> import HTMLgen
> from HTMLgen import *
>
> def test(req):
> html_page = HTMLgen.BasicDocument(title='Test')
> for i in util.FieldStorage(req).keys():
> html_page.append(i)
> return html_page
>
> def handler(req):
> html_page = HTMLgen.BasicDocument(title='Register')
> f = Form('http://69.56.173.110/register.py/test')
> f.append("Please pick a username and password")
> f.append("Username")
> f.append(Input(type='textfield', name='username'))
> f.append("Password")
> f.append(Input(type='password', name='passwd'))
> f = space(f)
> role = ['Official', 'Coach', 'Parent', 'Player']
> for choice in role:
> r = Input(type='radio', name='role', rlabel=choice)
> f.append(r)
> f.submit = Input(type='submit', value='register')
> html_page.append(f)
> req.write(str(html_page))
> return req
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
|