YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Checking Validation - Web Development

Get Embed Code
4 Languages

Showing Revision 11 created 05/25/2016 by Udacity Robot.

  1. Okay, so now we have these functions to validate the user's input.
  2. Let's talk about how they're going to fit into things.
  3. So we have you, and we have our servers, and you make a request for the form.
  4. This is a GET request, and the server responds with the form data,
  5. and then you make a POST request to the server with the data.
  6. In this case, it will be a month, day, and year.
  7. Now the server is going to run our validation functions,
  8. and it's going to do 1 of 2 things.
  9. If the data is good, the server will say, thanks,
  10. but if the data is bad, the server is going to respond with the form data again,
  11. and the server will also include an error message telling user to reenter their values,
  12. and they'll have the form handy so they can do that easily,
  13. and then we'll go up to this phase again.
  14. Okay, so let's talk about our approach to doing this.
  15. We're going to have to do 3 things.
  16. First, we're going to have to verify the user's input.
  17. Next, we're going to have to detect if it's an error and render the form again, maybe.
  18. And when we're rendering that form, we're going to need to include an error message
  19. because if we don't include that error message, the user is just going to hit submit on their form
  20. and see the form again, and they'll be confused forever.