liveBook · Manning

Required attribute

The required attribute is an HTML boolean attribute indicating that a form control must have a value for its form to pass validation.

How 2 Manning books explain it

Architecting Accessibility

An HTML attribute that indicates that a form control must have a value before its form can be submitted.

How it is used
Clarifies mandatory form inputs so people know what information is needed and can avoid incorrect submissions.
How deep it goes
Explains how the attribute exposes a required state to assistive technologies, without detailing its implementation.
Examples
Uses a booking-reference field and a dog-owner form to pair required controls with visible labels and instructions.
What you can do after
Apply the required attribute alongside visible “required” label text to communicate mandatory fields programmatically and visually.

Read how Architecting Accessibility explains required attribute →

HTML5 in Action

The required attribute specifies that a form control must have a value before its form can be submitted.

How it is used
Marks fields that must be populated before browser-side form submission can proceed.
How deep it goes
Defines the populated-field check and browser error, while deferring fuller form-validation details.
Examples
Uses a required field in an order form’s contact-details section and contrasts browser checks with server-side checks.
What you can do after
Apply native browser validation by marking fields that must be populated, while retaining server-side checks.

Read how HTML5 in Action explains required attribute →

Also covered in

Related concepts

Questions about required attribute

What is required attribute?

The required attribute is an HTML boolean attribute indicating that a form control must have a value for its form to pass validation.

Which Manning books explain required attribute?

Architecting Accessibility and HTML5 in Action.

What is required attribute a kind of?

Required attribute is a kind of attribute. An attribute is a named property or piece of information associated with an entity, object, or structured data item.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.