setData on submitting is not working #1711
Unanswered
laduniestu
asked this question in
Help (React)
Replies: 1 comment
-
There's a transform function on the const joined = {...data, ...additional};
// to update the form data for the inputs
setData(joined);
// use the inertia `router` instead of the `useForm` and supply the updated data
router.post('/endpoint', joined, {
// now you also have to manually set and clear the errors
onSuccess: () => {
clearErrors();
},
onError: (errors) => {
setError(errors);
}
}); It's kind of backwards since you have to manually set the form data to sync the inputs as well as the errors, which kind of defeats the purpose of using Similar issue to: #1131 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, how to setData before submiting form?
when i submit the form, the Photo data is not stored.
But when i submit again without refresh the page ( with same data from previous ) it will store.
Beta Was this translation helpful? Give feedback.
All reactions