liveBook · Manning

Form field

As explained in Acing the Frontend Interview

A form control is an interactive HTML element that accepts or selects user input within a form.

A form field is a control inside a <form> that accepts or selects user input. Common choices include <input> for text, email, passwords, checkboxes, and radio buttons; <textarea> for longer text; and <select> with <option> for a menu. section 2.4

In an interview, be ready to explain how users identify and correct a field. Wrap a control in its <label>, or connect a label’s for attribute to the control’s unique id. In React, write htmlFor instead of for. section 2.4

<label for="email">Email</label>
<input type="email" id="email" name="email" aria-required="true" aria-describedby="email-error">
<span id="email-error" role="alert" aria-live="assertive"></span>

The email-field example pairs a label with its input and connects the input to an error message. section 2.4

How Acing the Frontend Interview covers it

How deep it goes
Explains control types and implicit and explicit labeling, with an accessible error-message example.
Examples
Shows a username input with a label and an email input linked to an error message.
What you can do after
Build it from scratch with an appropriate HTML control, an associated label, and identifiable error feedback.
How it connects
Connects form fields to HTML forms, labels, accessibility, validation feedback, and React.

Also explained in

Compare how 4 books explain form field →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Frontend Interview. The section links point to the parts of the book it draws on.