You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to pass on the return value of options.onSubmit() inside form.handleSubmit() to be able to process returned values of the server response. For example the form could be valid but an error occurs when the form should be saved on the server. Or the form is stored successfully and I want to do something with the returned value.
Imagine the following use case: In an administration interface I have a view to create a new item with a form. To save I have two buttons: "Save and return to list view" and "Save and keep editing". Both buttons call form.handleSubmit() in their onClick handler. But depending on the result of the function they will continue in a different way.
I would like to pass on the return value of
options.onSubmit()
insideform.handleSubmit()
to be able to process returned values of the server response. For example the form could be valid but an error occurs when the form should be saved on the server. Or the form is stored successfully and I want to do something with the returned value.Imagine the following use case: In an administration interface I have a view to create a new item with a form. To save I have two buttons: "Save and return to list view" and "Save and keep editing". Both buttons call
form.handleSubmit()
in their onClick handler. But depending on the result of the function they will continue in a different way.I made the according commit here main...zoodirector:tanstack-form:handle-submit-results
and to illustrate the use case with an example: main...zoodirector:tanstack-form:handle-submit-results-example
Thanks for looking into it!
Kindly,
Nico
The text was updated successfully, but these errors were encountered: