-
Hi 👋 first time working with Remix so I'm probably doing something dumb. My Here's the full code: https://github.com/Swizec/spark-joy/tree/trying-remix/remix-sparkjoy The relevant codeMy form lives on a parametrized path <form
method="post"
action={`/${data.widget.widgetId}/saveFeedback`}
>
{data.widget.followupQuestions.map((q) => (
<Question {...q} key={q.id} />
))}
<button type="submit">Submit</button>
</form> This seems to work fine. The form renders and lets me submit. When I submit, the URL changes as expected. On my target page, the action tries to read formData, print it out, and redirect back to itself. I tried redirecting elsewhere but that didn't work either. export const action: ActionFunction = async ({ request, params }) => {
const formData = await request.formData();
console.log(formData);
return redirect(`/${params.widgetId}/saveFeedback`);
}; Instead of getting The errorThe error that I get indicates something goes wrong inside Remix machinery, so it isn't obvious how I can fix my code.
The questionAm I doing something wrong or did I stumble onto a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think the issue is that your inputs don't have names, so your post request from the form doesn't actually have a body. Remix should probably not die in this case, but it will also be avoided by providing a body by adding the |
Beta Was this translation helpful? Give feedback.
I think the issue is that your inputs don't have names, so your post request from the form doesn't actually have a body. Remix should probably not die in this case, but it will also be avoided by providing a body by adding the
name
attribute to your input fields.