Guide · Lovable
Add a working contact form to a Lovable app
Lovable builds a React front end. You can wire the form yourself or paste the prompt below into Lovable's chat and let it do the edit.
Create a free account and a form. Copy its access key.
In Lovable's chat, paste this prompt with your key filled in:
Make the contact form send its submissions to Zephos Forms. On submit, POST JSON to https://forms.zephos.dev/submit with the header "Accept: application/json" and the body { "access_key": "YOUR_ACCESS_KEY", "name": ..., "email": ..., "message": ... }. Add a hidden text input named "_gotcha" that is positioned off-screen (a spam trap) and include its value in the body. Show "Thanks, we got your message." when the response has success: true, and an error message otherwise. Don't add a backend or Supabase table for this.Or replace the form component yourself:
import { useState } from "react"; export function ContactForm() { const [status, setStatus] = useState("idle"); async function onSubmit(e) { e.preventDefault(); setStatus("sending"); const data = Object.fromEntries(new FormData(e.currentTarget)); const res = await fetch("https://forms.zephos.dev/submit", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify({ access_key: "YOUR_ACCESS_KEY", ...data }), }); setStatus(res.ok ? "sent" : "error"); } if (status === "sent") return <p>Thanks, we got your message.</p>; return ( <form onSubmit={onSubmit}> <input name="name" placeholder="Name" required /> <input name="email" type="email" placeholder="Email" required /> <textarea name="message" placeholder="Message" required /> <input type="text" name="_gotcha" tabIndex={-1} autoComplete="off" style={{ position: "absolute", left: "-5000px" }} aria-hidden="true" /> <button disabled={status === "sending"}>Send</button> {status === "error" && <p>Something went wrong. Try again.</p>} </form> ); }Submit the form once from your live site. The submission shows up in your dashboard and in your inbox.
Good to know
- On the free plan, visitors see a short thank-you page with a link back to your site. Paid plans send them to your own page (
_redirect). - Fields starting with an underscore are settings, not data:
_redirect,_subject,_replyto,_gotcha. - JSON requests get JSON back:
{ "success": true, "id": "sub_..." }.
Other guides: Plain HTML · Astro