how to prevent a `Form` from reloading the page when using the action attribute.
Unanswered
Field Sparrow posted this in #help-forum
Field SparrowOP
i could do everything in on Submit but next Form has the required action attribute.
8 Replies
next 15 right @Field Sparrow
Field SparrowOP
yep
Field SparrowOP
can you tell me why they made the action attriubte compulsory in next forms
Field SparrowOP
i can't get a response from the server action back
i would rather just use an onSubmit
African Slender-snouted Crocodile
It looks here https://nextjs.org/docs/app/api-reference/components/form like a combination of
action=""
(empty string) and setting preventDefault
in the onSubmit handler might do what you want?The empty string doesn't make it do nothing, but it might be the simplest thing to set it as if you have no intention of using that behaviour