values and formiApi is undefined in onSubmit #1308
-
I'm trying to capture the form values with the click of submit button. But the What am I missing here? Hoping for a quick response. Thank you!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Nilesh9768 that is because you are calling the <form
onSubmit={(e) => {
handleSubmit(e);
}}
>
// or simply
<form onSubmit={handleSubmit}> You can follow the docs here: https://data-driven-forms.org/components/form-template#heading-minimalformtemplate The on Her is your code with working submit: https://codesandbox.io/s/hungry-http-kdyqv9?file=/src/App.js:1393-1571 |
Beta Was this translation helpful? Give feedback.
@Nilesh9768 that is because you are calling the
onSubmit
but you are supposed to use thehandleSubmit
. The form submit callback should look like thisYou can follow the docs here: https://data-driven-forms.org/components/form-template#heading-minimalformtemplate
The on
onSubmit
is the actual unchanged onSubmit callback you pass to the renderer. And since you are not giving it any arguments, it does not has any in the callback.Her is your code with working submit: https://codesandbox.io/s/hungry-http-kdyqv9?file=/src/App.js:1393-1571