Next.js Discord

Discord Forum

Server side actions don't accept form data, empty classes error (gist attached +)

Unanswered
Crème D’Argent posted this in #help-forum
Open in Discord
Crème D’ArgentOP
"Hello, I'm using Next.js server actions. I've tried both ways of serializing the bind and also having the data as part of a hidden input, both of which are described in the Next.js documentation. However, when I try to use these methods, I get an error."

https://gist.github.com/hossam1231/02b69cb797c20ed9736d4e71b80d5a77

https://gist.github.com/hossam1231/9077821e655bbf881c399731c1cb9b5c

https://gist.github.com/hossam1231/84ac190e10f3c33614164ecdcf7c2c7a

18 Replies

 <form onSubmit={createIncidentWithEstablishmentId}>

you pass it to the onSubmit prop instead of action props
Crème D’ArgentOP
ahaha
thank you very much
❤️
il give it a try
bro i cant see where to do this
@Ray
change onSubmit to action
line 21
Crème D’ArgentOP
ohhhhh
i understnad
thanks
does it work?
Crème D’ArgentOP
yes it worked like a charm appricaite it alot
ive been stuc for a while
please mark solution