Save a form

6:43 film

After this film you cansave a form with a Server Function.

Exercise

Download the exercise (a zip). Unzip it, read exercise.md, then in exercise/ run npm install and node check.mjs. The checker runs a real build and says PASS or FAIL for each criterion.

Recall

Answer each one out loud before you open it.

  1. Where does a form's data go when its action is a Server Function?

    To that function on the server, as FormData, in one POST.

  2. Why does Bob's tap work before the JavaScript arrives?

    A form is HTML: the browser posts it by itself, and the server answers with the new page. That is progressive enhancement.

  3. Why does the function check the quantity when the form only offers 1–5?

    Anyone can POST to a Server Function directly, so the server can't trust the form.

Docs this film covers