File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55📚 ** Documentation** : https://darianstlex.github.io/efx-forms/
66
7- There are some breaking changes starting from v2
8-
97## Installation
108``` bash
119$ npm install efx-forms
@@ -365,23 +363,23 @@ interface FormInstance {
365363 * setErrors vs replaceErrors:
366364 * - setErrors: Merges errors into existing $errors (preserves unrelated field errors)
367365 * - replaceErrors: Completely replaces $errors with new errors (clears all existing errors)
368- *
366+ *
369367 * **Important**: Submit validation uses `replaceErrors` - server errors from `onSubmit` reject
370368 * will **replace** all client validation errors, not merge with them.
371- *
369+ *
372370 * Example:
373371 * // Current errors: { name: ['Required'] }
374372 * setErrors({ email: ['Invalid'] })
375373 * // Result: { name: ['Required'], email: ['Invalid'] }
376- *
374+ *
377375 * replaceErrors({ email: ['Invalid'] })
378376 * // Result: { email: ['Invalid'] }
379- *
377+ *
380378 * // Submit reject (uses replaceErrors):
381379 * onSubmit: async (values) => {
382380 * throw { email: 'Already exists' }; // Clears name error, only shows email
383381 * }
384- *
382+ *
385383 * Use cases:
386384 * - setErrors: Add field errors without clearing others (e.g., adding server errors to existing client errors)
387385 * - replaceErrors: Server validation response (clear all client errors, show only server errors) - **used by submit**
You can’t perform that action at this time.
0 commit comments