# On Input: Form Controls Without Surprises

Source: https://allyway.ai/glossary/on-input

On Input is WCAG success criterion 3.2.2. Changing the setting of a user interface component – typing in a field, choosing an option, ticking a checkbox – must not automatically cause a change of context unless the user has been advised of the behavior before using the component.

On Input is the WCAG rule that filling in a form must not trigger unexpected jumps. Choosing a country in a select list, ticking a checkbox or typing a digit should change exactly that – not submit the form, load another page or open a window, unless users were told beforehand. It makes forms predictable and keeps people in control of when something happens.

## What it means

[WCAG 3.2.2 On Input](https://www.w3.org/WAI/WCAG22/Understanding/on-input.html) is a Level A criterion of [WCAG 2.2](https://allyway.ai/regulations/wcag-2-2). It says: changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component.

A **setting** is a value or state that stays after the user leaves the control: the text in a field, the selected option in a list, the state of a checkbox or radio button. Links and buttons are not settings – activating them is supposed to do something.

A **change of context** is a major change of the user agent, the viewport, the focus, or content that changes the meaning of the page. Showing extra fields inside the same form is a content change and allowed.

| After the user changes a setting … | Allowed under 3.2.2? |
|---|---|
| More fields appear in the same form | Yes |
| A total price updates | Yes |
| The form is submitted automatically | No (failure F36) |
| A new window opens | No (failure F37) |
| Another page loads | No, unless announced first |
| Focus jumps to the next field | Only if explained before the form |

People using a [screen reader](https://allyway.ai/glossary/screen-reader) or screen magnifier often don't notice that the page changed. Keyboard users browsing a select list with the arrow keys can trigger a change with every key press – before they reach the option they want.

> **Tip:** > **A submit button solves most cases**
> W3C's main technique G80 is to let a button start the change. A select list for languages with a "Go" button next to it passes; the same list that reloads on every change does not.

## Examples

```html title="Example"
<!-- Bad: picking an option loads a new page right away -->
<select onchange="location.href = this.value">
  <option value="/en">English</option>
  <option value="/de">Deutsch</option>
</select>

<!-- Good: the change happens when the user presses the button -->
<form action="/language">
  <label for="lang">Language</label>
  <select id="lang" name="lang">
    <option value="en">English</option>
    <option value="de">Deutsch</option>
  </select>
  <button type="submit">Change language</button>
</form>
```

W3C names another passing example: a phone number form that moves focus to the next field automatically – because the form explains this behavior at its start. Telling users first (technique G13) is the alternative when a button is not wanted.

**Do:** Do

Use a submit button for actions that load pages or send data. Update content inside the form – extra fields, totals, [form labels](https://allyway.ai/glossary/form-labels) with hints – without moving focus. If a control must cause a change, say so in text before the control.

**Don't:** Don't

Submit a form when a value is entered or a radio button is chosen. Don't open a new window from a checkbox, radio button or select list without warning. Don't jump focus between fields without telling users first.

## How to check On Input



## Questions

Q: Is auto-submitting a form after the last field allowed?
A: Not without warning. W3C lists automatically submitting a form without prior warning when its last field is given a value as failure F36. Add a submit button, or tell users before the form that it will be sent automatically.

Q: Can a select list update the page without a button?
A: Yes, if the change stays within the page context – for example filtering a list below or showing extra fields. W3C technique SCR19 describes using onchange this way. Loading a new page from the list is a change of context.

Q: What is the difference between On Input and On Focus?
A: [On Focus](https://allyway.ai/glossary/on-focus) (3.2.1) covers what happens when an element only receives focus. On Input (3.2.2) covers what happens when a user changes a value or state. Both forbid unexpected changes of context.

Q: Does showing an error message break On Input?
A: No. An error message near a field is a content change, not a change of context. Make sure it is clear and announced – see [error identification](https://allyway.ai/glossary/error-identification) for how errors should be shown.

Q: How can I find form problems on my website?
A: Behavior on input needs a manual keyboard test. Missing labels and other form errors can be found automatically: allyWay's [free WCAG scanner](https://allyway.ai/free-wcag-accessibility-scanner-for-websites) checks a page and lists them.
