Form Integration

Contact forms for Same.new sites

Same writes Next.js apps and pushes them to Netlify when you say "Deploy my project". A cloned or generated contact page still needs somewhere to send its form. Point it at Formbold and messages are stored and emailed, with no API route or mail provider to set up.

Contact Form for Same

What does the Same.new contact component look like?

Same uses Next.js by default, so the form is a client component. It keeps a ref to reset the fields and shows the message Formbold returns.

same-new.tsx
"use client";
// app/contact/contact-form.tsx  (Same builds on Next.js by default)
// Remove the "use client" line only if you move this into the Pages Router.
import { useRef, useState } from "react";

export function ContactForm() {
  const formRef = useRef<HTMLFormElement>(null);
  const [pending, setPending] = useState(false);
  const [flash, setFlash] = useState<{ kind: "ok" | "err"; text: string }>();

  async function send(formData: FormData) {
    setPending(true);
    setFlash(undefined);
    try {
      const res = await fetch("https://formbold.com/s/FORM_ID", {
        method: "POST",
        headers: { "Content-Type": "application/json", Accept: "application/json" },
        body: JSON.stringify(Object.fromEntries(formData)),
      });
      const json = await res.json().catch(() => ({}));
      if (res.ok) {
        formRef.current?.reset();
        setFlash({ kind: "ok", text: json.message ?? "Sent. Talk soon." });
      } else {
        setFlash({ kind: "err", text: json.message ?? "Formbold said no. Check the form ID." });
      }
    } catch {
      setFlash({ kind: "err", text: "Offline? The message was not sent." });
    } finally {
      setPending(false);
    }
  }

  return (
    <form
      ref={formRef}
      onSubmit={(e) => {
        e.preventDefault();
        send(new FormData(e.currentTarget));
      }}
      className="flex flex-col gap-3"
    >
      <input name="email" type="email" required placeholder="Email" className="border rounded px-3 py-2" />
      <input name="subject" required placeholder="Subject" className="border rounded px-3 py-2" />
      <textarea name="message" rows={4} required placeholder="Message" className="border rounded px-3 py-2" />
      <button type="submit" disabled={pending} className="rounded bg-black py-2 text-white">
        {pending ? "Sending..." : "Send"}
      </button>
      {flash && <p className={flash.kind === "ok" ? "text-green-700" : "text-red-700"}>{flash.text}</p>}
    </form>
  );
}
How it works

Wiring Same.new to Formbold

Endpoint first, then a prompt, then Deploy my project.

1

Create the Formbold form

Click Create New Form in All Forms and copy https://formbold.com/s/FORM_ID from Form Setup.

2

Prompt Same

"Replace the contact page submit logic with a client component that POSTs email, subject and message as JSON to https://formbold.com/s/FORM_ID using fetch with Accept: application/json. Show the reply message on success and a red error line on failure, and disable the button while it sends. Do not add an API route, database or email package for this form."

3

Deploy and claim

Tell Same "Deploy my project", then submit once on the live URL. Claim the Netlify deployment if you want to keep the site and add a domain.

Features

What does Formbold add to a Same.new site?

Same handles the code and the deploy. These are the form jobs left over.

No API route

Same can write Next.js API routes, but a contact form does not need one when the browser posts to Formbold.

Works after you claim the site

Moving the deployment into your own Netlify account does not change anything for the form.

Spam settings that suit fetch

Basic Spam Filter is a toggle under Settings > Spam & Security. Custom reCAPTCHA covers fetch forms that need a captcha.

Email and a dashboard

Each entry is emailed and kept in Submissions, where you can star, filter and export it.

Webhooks and apps on Starter

Starter and higher forward entries to Slack, Sheets, Notion or a webhook of your own.

FAQs

Deploys, claims and cloned forms

Answers about deploys, claims and cloned forms.

Same says unclaimed deployments expire after 14 days of inactivity. Your code stays in Same and you can redeploy, but claim it if the form needs to stay live.

Still have a question?

The docs cover setup, framework guides, integrations and spam protection, step by step.