Skip to content

Commit

Permalink
modified checkboxgroup HTML form example
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhdeep12 committed Oct 27, 2024
1 parent 1b9171d commit cf8da30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion apps/docs/src/examples/checkbox-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ export function HTMLFormExample() {
e.stopPropagation();

const formData = new FormData(formRef);
alert(JSON.stringify(Object.fromEntries(formData), null, 2));
const subscriptions = Array.from(formData.getAll('subscriptions'));

const result = {
...Object.fromEntries(formData),
subscriptions,
};

alert(JSON.stringify(result, null, 2));
};

return (
Expand Down
10 changes: 9 additions & 1 deletion apps/docs/src/routes/docs/core/components/checkbox-group.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,16 @@ function HTMLFormExample() {
const onSubmit = (e: SubmitEvent) => {
e.preventDefault();
e.stopPropagation();

const formData = new FormData(formRef);
alert(JSON.stringify(Object.fromEntries(formData), null, 2));
const subscriptions = Array.from(formData.getAll('subscriptions'));

const result = {
...Object.fromEntries(formData),
subscriptions,
};

alert(JSON.stringify(result, null, 2));
};

return (
Expand Down

0 comments on commit cf8da30

Please sign in to comment.