How to pass data object along with the new resetForm json response #425
-
Hi, I love the new API's! Im upgrading my Remix codebase to V1. I have a form on a page that needs to be reset after successful completion and this works great:
However, I need to provide a better user experience and pass along the last submission data to let the client know that, in this case, the student name was successfully added to their roster. Is there a way to pass along more information with this implementation? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
When you set the return json({
result: submission.reply({ resetForm: true }),
submittedValue: submission.value,
}); |
Beta Was this translation helpful? Give feedback.
-
Thanks Edmund, that worked. I was expecting a status to come with the result response and that was what was getting me. |
Beta Was this translation helpful? Give feedback.
When you set the
resetForm
option, Conform will only includes the minimal data needed for the form reset and avoid sending data that's unnecessary. If you wanna include additional info, you can include them manually in the action response: