Skip to content
Lazyform
Docs menu

Frameworks and builders

HTML

Add a working contact form to any plain HTML page with Lazyform. One access key, one URL, no backend.

A plain HTML form is all Lazyform needs. Point the form's action at the Lazyform endpoint, add your access key as a hidden field, and every submission lands in your inbox (and anywhere else you connect). No JavaScript, no server.

Before you start

You need an access key for your form. Type your email on the homepage to get one instantly, or sign in and create a form in the dashboard. Keys look like lf_…. In the examples below, replace YOUR_ACCESS_KEY with yours.

The minimal form

contact.html
<form action="https://lazyform-api.xvelopers.com/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <input type="hidden" name="subject" value="New message from my website">

  <label for="name">Name</label>
  <input id="name" type="text" name="name" required>

  <label for="email">Email</label>
  <input id="email" type="email" name="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="5" required></textarea>

  <!-- Honeypot: bots tick it, people never see it. Leave it empty. -->
  <input type="checkbox" name="botcheck" class="hidden" style="display:none">

  <button type="submit">Send</button>
</form>

That's it. When a visitor submits, the browser posts the fields to Lazyform and is redirected to a thank-you page. Every field you add with a name is stored and delivered as-is, in the order it appears.

Want to send visitors back to your own page instead? Add <input type="hidden" name="redirect" value="https://example.com/thanks">. See Redirect after submit.

Submit without leaving the page

To keep visitors on the page and show a message inline, send the form with fetch and ask for JSON with the Accept: application/json header.

contact.html
<form id="contact-form" action="https://lazyform-api.xvelopers.com/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <input type="text" name="name" placeholder="Name" required>
  <input type="email" name="email" placeholder="Email" required>
  <textarea name="message" placeholder="Message" required></textarea>
  <input type="checkbox" name="botcheck" class="hidden" style="display:none">
  <button type="submit">Send</button>
  <p id="form-status" role="status"></p>
</form>

<script>
  const form = document.getElementById('contact-form');
  const status = document.getElementById('form-status');

  form.addEventListener('submit', async (event) => {
    event.preventDefault();
    const button = form.querySelector('button[type="submit"]');
    button.disabled = true;
    status.textContent = 'Sending...';

    try {
      const response = await fetch(form.action, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
        body: JSON.stringify(Object.fromEntries(new FormData(form))),
      });
      const result = await response.json();

      if (result.success) {
        status.textContent = 'Thanks! Your message has been sent.';
        form.reset();
      } else {
        status.textContent = result.error?.message || 'Something went wrong. Please try again.';
      }
    } catch {
      status.textContent = 'Network error. Please try again.';
    } finally {
      button.disabled = false;
    }
  });
</script>

Because the form still has a real action, it keeps working as a normal post if JavaScript fails to load.

Tips

  • Key in the URL instead. You can drop the hidden field and post to https://lazyform-api.xvelopers.com/f/YOUR_ACCESS_KEY.
  • Reply straight to the visitor. Name your email field email and replies to the notification go to the visitor. See Fields.
  • Files. Add enctype="multipart/form-data" and an <input type="file">. See File uploads.
  • Checkboxes. Several checked boxes with the same name arrive joined with ", ".

Where to go next