Next.js Discord

Discord Forum

Server action not submitting the form data properly??

Answered
Yellow-billed Magpie posted this in #help-forum
Open in Discord
Yellow-billed MagpieOP
Could anyone tell me if im doing anything wrong here?

In this form im just calling the server action as the docs instructs me to do but for some reason it is not being received on the function

As you can see in the console , every field is being returned as null for some reason.

Is there a specific reason why this is happening?
Answered by Sun bear
Change id= to name= and it should work.

The name property is the relevant one for sending the formdata
View full answer

4 Replies

Answer
@Sun bear Change id= to name= and it should work. The name property is the relevant one for sending the formdata
Yellow-billed MagpieOP
Oh well, that was a simple blunder. I had not realized it. Thanks that did it
Sun bear
You are welcome
Do note though that the htmlfor is for the id, not the name of the input field (iirc). So you may want to have both id and name here