UX Collective

We believe designers are thinkers as much as they are makers. https://linktr.ee/uxc

Follow publication

Member-only story

Accessible form validation from scratch — preparing for validation

Daniel Berryhill
UX Collective
Published in
9 min readJul 2, 2024
Stacked shipping containers.
Photo by Barrett Ward on Unsplash

In this article, I’ll go over how I’ll mark required fields, add help text, implement input groups, and add the markup for inline and summary validation.

In the next article, I’ll add styling.

Introduction

Here are the links to the articles in the series (so far):

But the markup needs a little more before we get into styling and JavaScript. Here are the topics for this article:

Marking required fields

How should we mark required fields? First, I hope we can all agree that the user must have some indication that fields are required — and that it should be done in a way perceivable visually and with assistive technology (AT).

Now that that’s out of the way, we can get to the debate of the best way to mark them.

As best as I can tell, there are four methods:

  • Mark required fields with a symbol (usually an asterisk or icon).
  • Remove all optional fields and inform the user that all fields are required.
  • Explicitly state which fields are required in the label
    (e.g., “First Name (required)”).
  • Only mark the optional fields in the label and inform the user that all fields are required unless otherwise stated.

All of these are compliant with WCAG (assuming they’re properly implemented), but I’m going for accessibility — not just compliance.

For that reason, I will mark all fields explicitly in the label.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Responses (3)

Write a response