import { PageSection } from "$fresh/www/components/PageSection.tsx"; import { SideBySide } from "$fresh/www/components/SideBySide.tsx"; import { CodeWindow } from "$fresh/www/components/CodeWindow.tsx"; import { CodeBlock } from "$fresh/www/components/CodeBlock.tsx"; import { SectionHeading } from "$fresh/www/components/homepage/SectionHeading.tsx"; import { DemoBox } from "$fresh/www/components/homepage/DemoBox.tsx"; import { ExampleArrow } from "$fresh/www/components/homepage/ExampleArrow.tsx"; import { FancyLink } from "$fresh/www/components/FancyLink.tsx"; import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx"; const routingCode = `import { Handlers } from "$fresh/server.ts"; export const handler: Handlers = { async POST(req) { const form = await req.formData(); // Do something with the form data here, // then redirect user to thank you page const headers = new Headers(); headers.set("location", "/thanks"); return new Response(null, { status: 303, headers, }); }, };`; export function FormsSection() { return (
Forms, the right way

Don't fight the browser. Fresh helps you handle form submissions and other dynamic requests server-side, from any route.

Since Fresh is built on{" "} Deno, it's built on web standards.

Forms in Fresh
); }