Form submit not working
Unanswered
Chinese perch posted this in #help-forum
Chinese perchOP
Hey there! The form submission is not working in next. I used the exact same code I used for another page, which works. Here's the file: https://gist.github.com/PrateekPathak9002/1d0a7b8420f9720feb3584c37aa0601f
The handle submit function never even triggers
Why won't this work??
The handle submit function never even triggers
Why won't this work??
48 Replies
@joulev Add use client to the top
Chinese perchOP
Hey! I'm new to next, so could you tell from where to import this?
Or just add:
use_client; at the top?"use client" add to the very top of the fileChinese perchOP
With quotes?
Yes
Chinese perchOP
Nothing
No change
Then you need to give me a repro repo
@joulev Then you need to give me a repro repo
Chinese perchOP
what?
repro repo?
Reproduction repository
Chinese perchOP
Oh
I'll push the changes
Basically a minimal repository that i can use to reproduce this problem
Chinese perchOP
1 sec
Minimal repository
It’s less likely i can see the problem quickly from a big repository
@joulev It’s less likely i can see the problem quickly from a big repository
Chinese perchOP
The project's not big
It's just the tutorial
Chinese perchOP
Index js submits form to login js
@joulev Basically a minimal repository that i can use to reproduce this problem
Chinese perchOP
Behaviour viewable at https://nextjs-blog-lilac-xi-24.vercel.app/login
I mean a nextjs project
With package.json, next.config.js, app/ and so on
Not just two files from which I cannot say anything
Due to lack of information
Chinese perchOP
ic
@joulev With package.json, next.config.js, app/ and so on
Chinese perchOP
the whole repo is there at
:
I don’t use chakra
But from here https://chakra-ui.com/docs/components/form-control/usage
It looks like you are using a wrong component
Just use <form> instead of <FormControl>
<FormControl> is a different thing for a different purpose and doesn’t have onSubmit
Chinese perchOP
oh
Thanks
@joulev <FormControl> is a different thing for a different purpose and doesn’t have onSubmit
Chinese perchOP
Never though chakra was the issue
If you used typescript you would instantly know what’s wrong
Chinese perchOP
How so?
Typescript would yell at you for trying to use onSubmit for FormControl which doesn’t accept onSubmit
Chinese perchOP
Nice
I'm thinking of switching, but I'd have to learn it first, and I wanted to know it's advantages
Other than looking more complex
You know things are wrong immediately