is it correct that `onChange` in `useForm` triggers validation on all form fields?
or
onBlur
5 Replies
quickest-silver•6mo ago
Form and Field Validation | TanStack Form React Docs
At the core of TanStack Form's functionalities is the concept of validation. TanStack Form makes validation highly customizable: You can control when to perform the validation (on change, on input, on...
conscious-sapphire•6mo ago
If it’s a validator on the form level, then yes. Otherwise you can also have validators in the field level for each field and have individual functions validate them
inland-turquoise•6mo ago
Note you can control when errors are surfaced by checking items like if your field is touched.
If you used RHF before this is actually different in TSF since RHF doesn’t append the error to their errors object unless you’re changing the field. TSF always appends the error to the errorMap regardless of the field you’re editing (when using a form level validator)
exotic-emeraldOP•6mo ago
do you ever want to show errors for all fields when blurring one of them? 🤔 I've firstly assumed it worked like a shorthand so I don't have to include validator prop in each field
quickest-silver•6mo ago
No, you check the isBlurred state on the Field level so errors for a field only become visible after you've blurred it