AnySites

// STORAGE AND FORMS

Static Site Forms

Collect form submissions from a static site with one HTML attribute — no backend code required.

Static sites can collect form submissions without any backend code — add netlify or data-netlify="true" to a <form> tag in your HTML, and AnySites' static build step rewrites it to submit to a serverless-style endpoint automatically.

How to declare a form

<form name="contact" netlify>
  <input type="text" name="name" />
  <input type="email" name="email" />
  <textarea name="message"></textarea>
  <button type="submit">Send</button>
</form>

The name attribute becomes the form's identifier in the dashboard (defaults to "form" if omitted — name it explicitly if a site has more than one form). At build time, AnySites scans every HTML file for this pattern, strips the netlify attribute, and injects a small script that intercepts the submit event and posts the form's fields as JSON to AnySites' form-receiving endpoint instead of doing a normal page navigation.

What happens on submit

  • On success, the script looks for an element with data-anysites-success in the form and reveals it if present; otherwise it replaces the form's contents with a default confirmation message.
  • On failure, it falls back to a plain browser alert() — for a custom failure UI, handle it yourself rather than relying on the default.
  • The first submission to a given form name creates it automatically — there's no separate "create a form" step in the dashboard.

Reading submissions

The project's Forms page lists every form and its submission count; open one to see individual submissions or export them as CSV. Submissions are stored indefinitely — there's no automatic retention limit — so delete old ones yourself if that matters for your data handling.

This only works for Static sites — the build-time HTML scan that wires up the interceptor script only runs on the static build pipeline. A container app needs to implement its own form-handling endpoint.

Related documentation