Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revised the text in the 'Using a form in a view' section.

  • Loading branch information...
commit 3c05b500a55406d0bd87cf24baa67469dbf90a03 1 parent d2ad3b0
Audrey Roy authored June 07, 2012 aaugustin committed June 08, 2012

Showing 1 changed file with 24 additions and 20 deletions. Show diff stats Hide diff stats

  1. 44  docs/topics/forms/index.txt
44  docs/topics/forms/index.txt
@@ -104,25 +104,29 @@ The standard pattern for processing a form in a view looks like this:
104 104
        })
105 105
 
106 106
 
107  
-There are three code paths here:
108  
-
109  
-1. If the form has not been submitted, an unbound instance of ContactForm is
110  
-   created and passed to the template.
111  
-2. If the form has been submitted, a bound instance of the form is created
112  
-   using ``request.POST``. If the submitted data is valid, it is processed
113  
-   and the user is re-directed to a "thanks" page.
114  
-3. If the form has been submitted but is invalid, the bound form instance is
115  
-   passed on to the template.
116  
-
117  
-The distinction between **bound** and **unbound** forms is important. An unbound
118  
-form does not have any data associated with it; when rendered to the user, it
119  
-will be empty or will contain default values. A bound form does have submitted
120  
-data, and hence can be used to tell if that data is valid. If an invalid bound
121  
-form is rendered it can include inline error messages telling the user where
122  
-they went wrong.
123  
-
124  
-See :ref:`ref-forms-api-bound-unbound` for further information on the
125  
-differences between bound and unbound forms.
  107
+There are three possible code paths here:
  108
+
  109
++------------------+---------------+-----------------------------------------+
  110
+| Form submitted?  | Data?         | What occurs                             |
  111
++==================+===============+=========================================+
  112
+| Unsubmitted      | None yet      | Template gets passed unbound instance   |
  113
+|                  |               | of ContactForm.                         |
  114
++------------------+---------------+-----------------------------------------+
  115
+| Submitted        | Invalid data  | Template gets passed bound instance     |
  116
+|                  |               | of ContactForm.                         |
  117
++------------------+---------------+-----------------------------------------+
  118
+| Submitted        | Valid data    | Valid data is processed. Redirect to a  |
  119
+|                  |               | "thanks" page.                          |
  120
++------------------+---------------+-----------------------------------------+
  121
+
  122
+The distinction between :ref:`ref-forms-api-bound-unbound` is important:
  123
+
  124
+* An unbound form has no data associated with it. When rendered to the user,
  125
+  it will be empty or will contain default values.
  126
+
  127
+* A bound form has submitted data, and hence can be used to tell if that data
  128
+  is valid. If an invalid bound form is rendered, it can include inline error
  129
+  messages telling the user what data to correct.
126 130
 
127 131
 Handling file uploads with a form
128 132
 ---------------------------------
@@ -294,7 +298,7 @@ templates:
294 298
     The field's label wrapped in the appropriate HTML ``<label>`` tag,
295 299
     e.g. ``<label for="id_email">Email address</label>``
296 300
 
297  
-``{{ field.value }}`` 
  301
+``{{ field.value }}``
298 302
     The value of the field. e.g ``someone@example.com``
299 303
 
300 304
 ``{{ field.html_name }}``

0 notes on commit 3c05b50

Please sign in to comment.
Something went wrong with that request. Please try again.