import { PageSection } from "../PageSection.tsx"; import { SideBySide } from "../SideBySide.tsx"; import { CodeWindow } from "../CodeWindow.tsx"; import { CodeBlock } from "../CodeBlock.tsx"; import { SectionHeading } from "../homepage/SectionHeading.tsx"; import { DemoBox } from "../homepage/DemoBox.tsx"; import { ExampleArrow } from "../homepage/ExampleArrow.tsx"; import { FancyLink } from "../FancyLink.tsx"; import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx"; const routingCode = `import { createDefine } from "fresh"; const define = createDefine(); export const handler = define.handlers({ async POST(ctx) { const form = await ctx.req.formData(); const treat = form.get("treat"); await db.votes.insert({ treat }); return new Response(null, { status: 303, headers: { location: "/thanks" }, }); }, });`; export function FormsSection() { return (
Forms that just work

Handle submissions server-side with standard Request and FormData. No client-side state management, no serialization headaches. Progressive enhancement comes free.

Forms in Fresh
); }