[Feature request] Global/root form error, independent of form fields #716
-
Hey! Imagine a user submits its form, (client) validation is successful, request is sent to the backend. But something goes wrong (network, business logic, etc.), so we'll e.g. get a 400 response. You could obviously do this yourself, but then you also have to keep track of the form's submissions, as the error may goes away after the next submit. So integrating it as part of the form would be nice. The easiest solution in my head is to have a new reserved field on the If I understand correctly, some API-related changes will soon allow to set field errors from the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Not sure if it has been added since your post, currently you can have an error that is bound to the form (not to a specific field). // Set the errors
form.setErrorMap({
onSubmit: formErrors.join(","),
}); // Show the errors
<p>{form.state.errors.join(', ')}</p> |
Beta Was this translation helpful? Give feedback.
-
We've actually supported form-level errors for a LONG time. Anything set from useForm's validators will be attached to the form object, not fields |
Beta Was this translation helpful? Give feedback.
We've actually supported form-level errors for a LONG time. Anything set from useForm's validators will be attached to the form object, not fields