Prompt to replace exported forms with a form endpoint

Short answer

This prompt asks an AI assistant to find every form in an exported site, record its fields, and point each one at a form endpoint you choose: a hosted service, Netlify Forms or a Cloudflare Pages Function. It also writes a test list, because a form that looks fine can deliver nowhere.

Last reviewed

Key facts

  • Forms keep their markup after an export but lose the backend that received submissions.
  • Netlify Forms needs data-netlify="true" and a unique name on each form, plus form detection turned on.
  • A hosted form service gives you an https endpoint for the form action.
  • Test status: run on a real export. It found one form, a script-driven URL field with no action, which the prompt now tells the assistant to report instead of converting. Contact-form conversion has not been tested.

The prompt

Paste this into Claude Code, Cursor, Gemini CLI or another AI coding assistant with your project folder open, and replace everything in square brackets first. See how to run it in each tool.

Replace exported forms
You are fixing forms in a static export in ./exported-site. The original platform handled submissions. It no longer does.

STEP 1: FIND
List every <form> in every page: file, form id or name, fields (name, type, required), current action and method. Write the table to FORMS.md.

STEP 2: CHOOSE
Use this destination: [ENDPOINT: Formspree URL, Netlify Forms, or Cloudflare Pages Function at /api/contact]

STEP 3: CONVERT
- If a form has no action and a script handles it (a search box or a URL field, for example), do not convert it. List it in FORMS.md as script-driven.
- Set method to POST.
- For Formspree, set action to [FORMSPREE_URL].
- For Netlify Forms, add data-netlify="true" and a unique name attribute to each form.
- For a Pages Function, post to /api/contact and write the function in functions/api/contact.js. It must read the form data, check that required fields are present, and return a plain success response.
- Add a hidden honeypot field named company that real visitors never fill. Reject submissions where it has a value.
- Keep labels, classes and layout as they are.

STEP 4: TEST LIST
Write TESTS.md with one manual test per form: what to type, where the message should arrive.

RULES
- Do not remove any platform script until I say so, because some scripts also handle form behavior.
- Do not invent an endpoint. Use the placeholder if I did not give one.

How to run it

  1. Decide where submissions should go: your inbox through a hosted service, the Netlify Forms inbox, or your own function.
  2. Send the prompt with the endpoint filled in and review FORMS.md before the assistant edits anything.
  3. Deploy to a preview address, because most endpoints need the live site to receive a real submission.
  4. Submit each form once with a real address and tick it off in TESTS.md.

The three endpoint options

OptionWhat you changeWhere submissions landWatch for
Hosted form serviceThe action attribute points at the service URLThe service inbox and your emailSpam filtering and monthly limits on the service plan
Netlify Formsdata-netlify="true" and a unique name on a static formThe Forms tab in the Netlify dashboardForms drawn by JavaScript are not detected at deploy time
Cloudflare Pages FunctionThe action points at /api/contact and you write the functionWherever your function sends itThe _headers file does not apply to what a Function returns

This is the shape of a plain form that posts to a hosted service. Replace the form ID with your own.

contact.html
<form action="https://formspree.io/f/your-form-id" method="POST">
  <label>Email <input type="email" name="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <input type="text" name="company" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true">
  <button type="submit">Send</button>
</form>

Verify the result

Check the converted markup, then deploy and send one real submission per form. This command lists every form action so you can spot any that still point at the old platform.

terminal
grep -rn "<form" ./exported-site --include="*.html" | head -20
grep -rn "action=" ./exported-site --include="*.html" | head -20
  • Every form has method POST and an action or a data-netlify attribute.
  • Each form delivered one real test message to the expected inbox.
  • The honeypot field is hidden from visitors and does not break the layout.

What can go wrong

  • The old platform script still intercepts the submit event and sends the data to the old backend. If tests fail, test with that script removed.
  • Netlify does not detect forms that JavaScript draws in the browser. Add a hidden static form with the same name.
  • No success page. Visitors do not know the message went through, so set a thank-you page or message.

Frequently asked questions

Why did my exported form stop working?

The platform’s servers collected the submissions, and a static host has no such service. Webflow’s help says forms do not work in exported code, and other builders work the same way.

Which option is quickest?

A hosted form service, because you change one attribute. Netlify Forms is as quick if you already host on Netlify.

Does WebExport offer a form relay?

Yes. Exported forms can use the WebExport webhook relay, Formspree, Zapier, Make or a native server endpoint.

How do I stop spam?

A honeypot field catches simple bots. A form service or your function can add more checks. The prompt adds the honeypot for you.

Official documentation

Free tools for this job

Start with the files

Prompts work best on a WebExport download of your site. Paste your public URL into the export form and get a ZIP. The Free plan covers 1 site, 5 exports a month, 15 pages and 20 MB per export. Professional is a $9.99 one-time purchase with unlimited pages.