Skip to content

values and formiApi is undefined in onSubmit #1308

Discussion options

You must be logged in to vote

@Nilesh9768 that is because you are calling the onSubmit but you are supposed to use the handleSubmit. The form submit callback should look like this

<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 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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Nilesh9768
Comment options

Answer selected by Nilesh9768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants