Getting multiple form data as dictionary on Python GAE

41 views
Skip to first unread message

Tomiwa Adefokun

unread,
Nov 20, 2009, 1:07:15 PM11/20/09
to Google App Engine
Good evening,

I am Tomiwa from Nigeria. I have been working with appengine for a
couple of weeks, on the python platform and I need to get something
done hope you could help.

If I have a form input element such as:

<input name="form[name]" />
<input name="form[sex]" />

How can I read this into a dictionary such as form = {'name': '',
'sex': ''} and then be able to have form['name'] and form['sex']

Such can be done in PHP by just using $_form = $_POST['form'].

I will be so happy to hear from you.

Thank you.

Ikai L (Google)

unread,
Nov 23, 2009, 6:35:52 PM11/23/09
to google-a...@googlegroups.com
If you're using Webapp, you can retrieve these parameters like so:

    def post(self):
      name = self.request.POST["form[name]"]
      sex = self.request.POST["form[sex]"]

Other frameworks such as Django have Form abstractions for dealing with form input that will also provide helpers for things such as data validation.


--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=.





--
Ikai Lan
Developer Programs Engineer, Google App Engine
Reply all
Reply to author
Forward
0 new messages