small medium large xlarge

Generic-user-small
09 Apr 2012, 20:58
Charlie (3 posts)

What does “action=” mean in a django template form mean?

Generic-user-small
10 Apr 2012, 01:46
Mark Chu-Carroll (14 posts)

It’s the standard HTML action tag. It supplies the HTTP operation and URL to use when the form is submitted.

So if you had a tag:

[form action=”/contact/” method=”post”]

(using brackets, to get around html grief), what that means is: when the user submits the form, submit it using a POST to the “/contact/” URL at the same server that the current page came from.

Generic-user-small
10 Apr 2012, 10:29
Charlie (3 posts)

What would I put where /contact/ is?

Also, how would I reference the input of the form in a python file?

Generic-user-small
20 Apr 2012, 18:03
Matthias Schoener (1 post)

“/contact/” is a path on the web server. It needs to correspond to the URL that you associate with a request handler in your WSGIApplication call (see p.58 in the printed edition for an example).

You reference the form input inside the post function that you create as part of the request handler. Look at the sample code provided on p.63 of the printed edition (login-chat/pchat.py):

msgtext = self.request.get(“message”)

This assigns the contents of the “message” textarea in the form (p.62) to the variable msgtext.

Generic-user-small
05 Jul 2012, 10:03
Flipper Pigo (1 post)

i’m interesed too

  You must be logged in to comment