Skip to content
VibecodeZero

How to fix forms in a vibe-coded app (Lovable, Bolt, Supabase)

Updated

On this page (4)
  1. Symptom
  2. Cause
  3. Prompt to paste
  4. How not to burn credits

Symptom

You fill in a form in your app and click the button, and something goes wrong. Nothing happens, or the page reloads and what you typed vanishes, or a message appears on a field, or the app says "sent" but nothing shows up in the database, or a contact form never sends the email.

Cause

This page covers forms: contact forms, sign-up forms, booking forms and any screen where someone types something and clicks a button to send it. If the problem is a button that isn’t part of a form, start with I clicked the button and nothing happened. If you see a database error code, Database errors in a vibe-coded app explains each one.

The facts below come from Supabase’s docs on Row Level Security and API keys; MDN’s pages on the button element, sending form data, preventDefault and form validation; Lovable’s docs on the preview, publishing, logs, data access rules and emails; and Bolt’s help center pages on sending emails, database logs and database security. All checked October 27, 2026.

Which form problem do you have?

What you see Most likely cause Jump to
It says “sent”, but nothing is saved A security rule (RLS) or a missing permission blocked the save Nothing is saved
Clicking the button does nothing at all The action isn’t wired, or it fails without a message The button does nothing
The page reloads and the form is empty again The browser’s default submit The page reloads
A message appears on a field and nothing is sent A validation rule, like a required field Validation messages
It works in the preview, not on the published site Unpublished changes, or a rule that only allows signed-in users Preview vs published
The form works, but the email never arrives No server code or email service, or the domain isn’t set up No email

The form says “sent”, but nothing is saved

This is the most common one, and the most confusing, because the screen looks fine. Apps built on Lovable Cloud, on a Bolt database or on your own Supabase project save form data into a Postgres database protected by security rules, called RLS (Row Level Security) policies. Each rule says who can read, add, change or delete rows in a table.

Supabase’s docs list two ways a save gets refused with error 42501:

  • A missing permission on the table. This fails before any rule runs.
  • A rule that doesn’t allow the new row. Rules for adding rows (INSERT) use a with check condition, which, in Supabase’s words, makes sure “a user cannot create a row that belongs to someone else.”

Who fills in the form matters. Supabase’s docs say a request from someone who isn’t signed in uses the anon role, and a signed-in person uses the authenticated role. A rule written only for signed-in users blocks a public contact form. And for someone who isn’t signed in, auth.uid() (the signed-in user’s ID) is null, so a rule like “people can add their own rows” can’t match them.

If the app still says “sent” after a refused save, the code is ignoring the error. Ask the AI to show a message when a save fails, so you’re not left guessing next time.

Where to look:

  • Lovable: open More → Database, select Manage, then Policies, and filter by the form’s table. Each rule shows its Command (INSERT is adding) and who it Applies to (authenticated or anon). The view is read-only, so ask in the chat to change a rule. For the exact error, open More → Settings → Logs and choose PostgreSQL logs. Logs don’t update live, so click Refresh after you try the form again.
  • Bolt: click the database icon at the top center of your project, then Logs, and choose PostgreSQL. Then open Security, which flags problems like a missing RLS policy and shows an Ask Bolt to fix button when it finds one and you can edit the project.
  • Your own Supabase project: use the Supabase dashboard.

For a public form, allow adding, not reading. The fix for a contact form is one rule that lets anon INSERT into that table. Don’t add a read (SELECT) rule for anon on it. Supabase’s docs say a rule like to anon using ( true ) gives every visitor who isn’t signed in read access to every row that role can reach, and to use it only for data meant to be public. Your contact messages, with names and emails, are not.

The button does nothing

If nothing happens at all, no reload and no message, the button may not be connected to an action, or the action fails without telling you. I clicked the button and nothing happened covers this step by step. In Lovable, you can also ask it to investigate: Lovable’s docs say that when you describe what you see and what you expected, it can inspect errors, logs and console output, and test your app in a browser, including filling in and submitting forms.

The page reloads and the form clears

This is the browser doing what forms did before apps existed. MDN explains two defaults:

  • A button inside a form is a submit button unless it’s marked type="button". MDN warns that other buttons in a form, like “Add another item”, will otherwise try to submit it.
  • A form with no address (action) sends its data to the current page, which reloads it. Everything typed is lost.

In an app, the code should handle the submit itself and tell the browser not to do its default action. That’s what preventDefault() is for: MDN says it tells the browser the event “is being explicitly handled, so its default action … should not be taken.” Ask the AI to check that this form handles its own submit, and that extra buttons inside it don’t submit it.

A message appears on a field

The browser is blocking the form on purpose. MDN says that when a field breaks a validation rule, for example an empty field marked required, the browser blocks the submission and shows an error message, and the form isn’t sent at all.

If the rule is right, fill in the field. If it’s wrong, like a phone field rejecting a valid number, tell the AI which field, what you typed and what message you got.

The database can also refuse a value after the browser accepts it. A required column left empty (23502), a value that must be unique and already exists (23505, for example an email that’s already signed up) and a value in the wrong format (22P02) are all database errors with their own codes.

MDN also says browser checks are “too easy to bypass”, so the app should check the data on the server as well. Ask the AI to do both.

It works in the preview, but not on the published site

Two things to check, in this order:

  1. Did you publish your latest changes? Lovable’s docs say the published app is a snapshot that only changes when you publish again, and a small dot on the Publish button means there are newer changes to publish. In Bolt, open the Publish menu and click Update. See My published link still shows the old version.
  2. Who is filling it in? Lovable’s docs say the preview and the published app share the same backend and data, so the database is the same in both. What usually differs is the person. In the editor you’re signed in, and your visitors usually aren’t. If a rule only allows signed-in users, the form works for you and fails for them. Test in a private browser window, signed out.

If the form is part of signing in, see Lovable login works in preview but not on the published site. For other preview vs published problems, see Lovable preview works, published app doesn’t.

The contact form doesn’t send the email

A form can’t send email by itself. Something on the server has to send it through an email service, and that service needs a domain set up to send from.

In Lovable. Lovable’s built-in emails are on paid plans. You need a domain you own and access to its DNS settings, and only a domain marked Verified can send. Older React + Vite apps also need the built-in backend, because their server code runs there. Apps on TanStack Start, which Lovable uses for new apps since May 13, 2026, have their own server. To see what happened to an email, open More → Emails → Analytics and logs: the activity log lists recent emails with their status and the error message for failures. Two more reasons from Lovable’s docs: when a workspace reaches its hourly limit (100 app emails an hour on Pro), Lovable rejects new emails until the hour resets, and emails from a newly set up domain may land in spam at first. If you use Resend through Lovable’s Resend connector instead, it sends from a domain you’ve verified in Resend.

In Bolt. Bolt’s guide sends email through a server function and an email service. If you don’t pick one, Bolt typically uses Resend, and you still add your own Resend API key as a secret named RESEND_API_KEY (click the database icon, then Secrets). The guide expects a published project with a custom domain, added in Resend with its DNS records. Bolt says sending should start once the records resolve, usually 10 to 20 minutes, sometimes a few hours. To check, send a test from your app and look for delivery logs or errors in the Resend dashboard.

Whichever tool you use, ask the AI to also save each message in the database. That way a failed email doesn’t lose the message.

What not to do

  • Don’t turn RLS off to make the form work. Supabase’s docs say a table without RLS in an exposed schema can be read and changed by any role with access to it. For a contact form, that’s every message, name and email. See Could my app be exposing personal data?
  • Don’t put a secret key or the service_role key in the browser. Supabase’s docs say secret keys bypass RLS and “must never leave your control”. If the AI suggests one to make a form save, ask for an RLS rule instead.
  • Don’t let anon read the table. Visitors need to add rows to a public form, not see what others sent.

Prompt to paste

Copy the text below, replace what’s in brackets and send it in the chat of the tool you’re using.

Paste into the AI
The "[form name]" form on [page name] doesn't work.
What I do: [for example "fill in name, email and message, then click Send"]
What happens: [for example "it says Sent, but nothing appears in the database" or "the page reloads and the form is empty"]
Who is filling it in: [signed in / not signed in / both]
Does it work in the preview: [yes / no / not tested]
The exact error, if any: [paste it from the screen or the logs]

Don't change anything yet. Check, in this order, and explain in plain English:
1. Whether the form's submit is handled by the app or the page just reloads.
2. Which validation rules run, in the browser and on the server.
3. Which table the form saves to, and whether its RLS policies allow INSERT for the role that fills it in (anon or authenticated).
4. Whether the app shows the user an error when the save fails.
5. If it sends an email: which server code and email service send it, and what the email logs say.
Keep RLS on for every table. Don't let visitors read the table, and don't put a secret or service_role key in the browser.
Tell me the smallest fix and wait for my confirmation.

How not to burn credits

  • Say which of the six symptoms you have, and whether the person filling in the form is signed in. That alone points the AI at the right part of the app.
  • Copy the exact error before you ask. In Lovable, open More → Settings → Logs and pick PostgreSQL logs. In Bolt, click the database icon, then Logs, and pick PostgreSQL. A pasted error is cheaper than a round of guesses.
  • Ask for an explanation first, like the prompt on this page does. In Lovable, Plan mode and Chat mode investigate without changing your code.
  • Test the fix as a visitor, not only as yourself. Open the published app in a private window, fill in the form and check that the row or the email arrived.

How Lovable counts credits, and what the free plan includes: Lovable credits explained.

Questions people ask

Why does my form say it was sent but nothing is saved?

Usually a database security rule (RLS) or a missing permission blocked the save. Supabase's docs say both raise error 42501. If the person filling in the form isn't signed in, their request runs as the anon role, so the table needs an INSERT rule for anon, not only for signed-in users. If the app still shows "sent", it's ignoring the error. Ask the AI to check the table's INSERT rules for the right role and to show an error when a save fails.

How do I let visitors submit a contact form without opening my database?

Allow only adding rows. A rule that lets the anon role INSERT into the contact table lets visitors send messages. Don't add a SELECT (read) rule for anon on that table: Supabase's docs say a read rule like that gives every visitor who isn't signed in access to every row that role can reach, so only use it for data meant to be public. Keep RLS on, and read the messages yourself while signed in, in your app or the backend's database view.

Why does the page reload when I click Submit?

That's the browser's default. MDN explains that a button inside a form is a submit button unless it's marked type="button", and a form with no action sends its data to the current page, which reloads it. In an app, the code should handle the submit itself and tell the browser not to do the default action, which is what preventDefault() does. Ask the AI to check that for this form.

Why won't the form submit when a field shows a message?

The browser is blocking it on purpose. MDN says that when a field breaks a validation rule, such as an empty field marked required, the browser blocks the form submission and shows an error message. Fill in the field, or ask the AI whether that rule is right. MDN also says browser checks are easy to bypass, so the app should check the data on the server too.

The form works in the preview but not on my published site. Why?

In Lovable, check first that you published your latest changes: Lovable's docs say the published app is a snapshot that only changes when you publish, and a dot on the Publish button means there are newer changes. In Bolt, use Update in the Publish menu. Lovable's preview and published app share the same backend and data, so the next thing to check is who is filling it in. In the editor you're usually signed in, and your visitors aren't, so a rule that only allows signed-in users blocks them.

Why doesn't my contact form send an email?

A form can't send email by itself. The app needs server code and an email service. In Lovable, built-in emails are on paid plans and need a domain you own with its DNS set up, and More → Emails → Analytics and logs shows failed emails with their error. Lovable also rejects new emails when a workspace hits its hourly limit. In Bolt, emails go through a server function and an email service like Resend, with your API key saved as a secret, and Bolt's guide expects a published project with a custom domain.

Can I turn off RLS to make the form work?

No. Supabase's docs say a table without RLS in an exposed schema can be read and changed by any role with access to it, and recommend RLS on every such table. For a contact form, that would put every message, with names and emails, in reach of anyone. Add the one INSERT rule the form needs instead.

New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe