Skip to content
Lazyform
Docs menu

Frameworks and builders

Wix

Add a Lazyform contact form to a Wix site with an HTML embed, since Wix's built-in forms can't post to an external URL.

Wix's built-in forms keep submissions inside Wix and can't post to an outside URL. To use Lazyform on Wix, add an HTML embed (sometimes called "Embed HTML" or "Custom embed") and paste a small form into it.

Before you start

Get an access key: type your email on the homepage for an instant key, or sign in and create a form. You'll paste it where you see YOUR_ACCESS_KEY (keys start with lf_).

Add the form

  1. In the Wix Editor, click Add (the plus button) and look for Embed Code, then Embed HTML.
  2. Drag the HTML element onto your page and choose Code (not Website address).
  3. Paste the code below and replace YOUR_ACCESS_KEY.
  4. Resize the element so the whole form, including the message under the button, is visible.
  5. Publish and send a test message from the live site.
Wix HTML embed
<style>
  body { margin: 0; font-family: system-ui, sans-serif; }
  #lazyform { display: grid; gap: 12px; max-width: 520px; }
  #lazyform input, #lazyform textarea { padding: 10px 12px; border: 1px solid #ccc; border-radius: 6px; font: inherit; }
  #lazyform textarea { min-height: 120px; }
  #lazyform button { padding: 12px; border: 0; border-radius: 6px; background: #111; color: #fff; font: inherit; cursor: pointer; }
</style>

<form id="lazyform" 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="lazyform-status" role="status"></p>
</form>

<script>
  const lf = document.getElementById('lazyform');
  const status = document.getElementById('lazyform-status');

  lf.addEventListener('submit', async (e) => {
    e.preventDefault();
    status.textContent = 'Sending...';
    try {
      const res = await fetch(lf.action, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
        body: JSON.stringify(Object.fromEntries(new FormData(lf))),
      });
      const result = await res.json();
      status.textContent = result.success
        ? 'Thanks! Your message has been sent.'
        : result.error?.message || 'Something went wrong.';
      if (result.success) lf.reset();
    } catch {
      status.textContent = 'Network error. Please try again.';
    }
  });
</script>

Why the form shows its message inline

Wix runs HTML embeds inside a separate frame. If the form redirected after submitting, the thank-you page would open inside that small box. The script above sends the form in the background and shows the result under the button instead, so the visitor stays on your page.

The frame also doesn't inherit your site's fonts and colors, which is why the snippet includes its own <style> block. Change it to match your design.

Because embeds are served from a Wix-owned domain, the request doesn't come from your own domain. If you turn on allowed websites for this form, submissions may be refused with domain_not_allowed. Leave that setting off for Wix, or test carefully after enabling it.

Tips

  • Wix Studio and Velo. The same HTML embed works in Wix Studio. If you use Velo, you can also post to the endpoint from backend code with fetch, sending JSON with Accept: application/json.
  • More fields. Copy an input and give it a new name. Every named field is delivered in the order it appears.

Where to go next