-
Hi, export const action: ActionFunction = async ({ request }) => {
const formData = await request.formData();
console.log(Object.fromEntries(formData), formData.getAll("tags"));
return null;
};
export default function App() {
return (
<Form method="post">
<input type="checkbox" name="my-input" value="1" />
<input type="checkbox" name="my-input" value="2" />
<input type="checkbox" name="my-input" value="3" />
<input type="checkbox" name="my-input" value="4" />
<button type="submit" />
</Form>
);
} I tried with different names : Thanks in advance for you help |
Beta Was this translation helpful? Give feedback.
Answered by
kiliman
May 6, 2022
Replies: 1 comment 2 replies
-
You had the right idea, just the wrong name.
NOTE: |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
jorisre
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You had the right idea, just the wrong name.
formData.getAll("my-input")
NOTE:
Object.fromEntries()
will only get the last entry as it doesn't handle multiple items.