TanStack / TanStack/form

onSubmit validation skips untouched fields when some fields have onBlur validation

Open
#1,663 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question v1 v2: needs investigation
Dominant language
TypeScript
Stars
6.7k
Forks
682
Avg merge
5d 18h
Merged PRs (30d)
7

Description

Describe the bug

When using TanStack Form with onBlur validation on all individual fields and onSubmit for the entire form, the onSubmit validation only validates fields that have been "touched" (focused/blurred). Fields that haven't been interacted with are skipped during form submission validation, even though they should be validated.

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-sviy39k3?file=src%2FApp.tsx

Steps to reproduce
  1. Focus and blur the "First Name" field (leave it empty)
  2. Leave the "Last Name" and "Email" fields completely untouched
  3. Click "Submit Form"
  4. Notice that only First Name shows an error, but Last Name and Email don't

Note: If you submit without blurring any fields, all fields are correctly validated and show errors.

Expected behavior

All fields should be validated on form submission, regardless of whether they have been touched or not. The onSubmit validation should validate the entire form schema, not just the "dirty" fields.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • OS: macOS 15.5
  • Browser: Chrome
  • Version: 138.0.7204.184
TanStack Form adapter

react-form

TanStack Form version

v1.15.2

TypeScript version

v5.9.2

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction using the react-form adapter and follow the form submission validation behavior with onBlur validation enabled on each field. Confirm that submitting after only First Name is blurred also reports errors for untouched Last Name and Email, while preserving the behavior where submitting immediately validates all fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.