HTML forms

form, label, input and its types, validation attributes, and what the browser sends with GET or POST: knowing which fields are sent and how the request is written.

  • 26 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. The numbers
  5. Scenarios

A few cards from the deck

  • A field's name attribute: what is it?

    Show the answer

    The key under which the field's value is sent to the server, in the key=value pair.

    A field without name is not sent at all, even when filled in. name is not id, which is used to link a label or to target the field in CSS.

  • A GET form with action /search contains <input name="q"> filled with "cat" and <select name="lang"> set to "fr". Which URL does the browser request?

    • /search?q=cat&lang=fr
    • /search?q=cat;lang=fr
    • /search?q=cat?lang=fr
    • /search/cat/fr
    Show the answer

    /search?q=cat&lang=fr

    A single ? opens the query string, then each name=value pair is separated from the next by &. Fields are sent in the order they appear in the form.

  • The … attribute of form gives the address that receives the data, and the … attribute the HTTP method used to send it.

    Show the answer

    The action attribute of form gives the address that receives the data, and the method attribute the HTTP method used to send it.

    Without action, the form is sent to the address of the current page. Without method, it is GET.

  • Label: what is it?

    Show the answer

    An element that names a form field; its for attribute repeats the field's id, and clicking it activates the field.

    A screen reader reads its text when reaching the field. placeholder does not replace it: it disappears as soon as you type.