How forms work

Forms can be tricky to understand because interacting with them takes more than one request-response cycle. In the simplest scenario, you need to present an empty form, which the user then fills in correctly and submits. Conversely, they might enter some invalid data, in which case the form needs to be resubmitted until the entire form is valid.

From this scenario, we can see that a form can be one of several states, changing between them:

  • Empty form (unfilled form): This form is called an unbound form in Django
  • Filled form: This form is called a bound form in Django
  • Submitted form with errors: This form is called a bound form but not a valid form
  • Submitted form without errors: This form is called a bound and valid form
The users will never see the form in the submitted form without errors state. They don't have to. Typically, submitting a valid form should take the users to a success page.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.237.136