# 8.7 Validate on submit and keep the input

> Chapter 8, States. Section: Errors, validation, and disabled controls. Guide: https://www.designguide.dev/md/08-states.md#validate-on-submit-and-keep-the-input

Default

**Rule:** Validate when the person submits, focus the first error, and keep the invalid input visible and unchanged.

**Why:** An error while typing scolds an unfinished thought. A rewrite loses the original.  **When not:** Check a username or a code as the person types only when a check needs the full value.

- Show the error after a failed submit.
- Clear each error as soon as the value is valid.
- Never rewrite the person's text while they type.

**Picture:** Do: The typed text stays. The error shows a sample date. Don't: The app replaced the typed date, and the person's input is lost.
