onSubmit validation skips untouched fields when some fields have onBlur validation
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 6.7k
- Fork
- 682
- Merge trung bình
- 5 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 7
Mô tả
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
- Focus and blur the "First Name" field (leave it empty)
- Leave the "Last Name" and "Email" fields completely untouched
- Click "Submit Form"
- 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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với bản tái hiện StackBlitz được liên kết bằng cách sử dụng adapter react-form và theo dõi hành vi xác thực khi gửi biểu mẫu với xác thực onBlur được bật trên từng trường. Xác nhận rằng việc gửi sau khi chỉ First Name mất focus cũng báo lỗi cho Last Name và Email chưa được chạm vào, đồng thời giữ nguyên hành vi trong đó việc gửi ngay lập tức sẽ xác thực tất cả các trường.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100