Form previewSubmissions stay in this preview

Try the example

Add constraints that reflect the kind of responses you need. The message in this example accepts between ten and four thousand characters.

HTML
<form id="contact" action="https://api.bitebrake.com/api/submit" method="post">
  <input type="hidden" name="access_key" value="YOUR_FORM_ACCESS_KEY">
  <label>Name <input name="name" autocomplete="name" required></label>
  <label>Email <input name="email" type="email" autocomplete="email" required></label>
  <label>Message <textarea name="message" rows="5" minlength="10" maxlength="4000" required></textarea></label>
  <div hidden><label>Leave empty <input name="botcheck" tabindex="-1" autocomplete="off"></label></div>
  <button type="submit">Send message</button>
  <p role="status"></p>
</form>

<script type="module">
  const form = document.querySelector("#contact");
  const button = form.querySelector('button[type="submit"]');
  const status = form.querySelector('[role="status"]');

  form.addEventListener("submit", async (event) => {
    event.preventDefault();
    button.disabled = true;
    status.textContent = "Sending…";

    try {
      const response = await fetch(form.action, {
        method: "POST",
        headers: { Accept: "application/json" },
        body: new FormData(form),
      });
      const result = await response.json().catch(() => null);
      if (!response.ok || !result?.success) {
        throw new Error(result?.error || "The form could not be sent.");
      }
      form.reset();
      status.textContent = "Message received.";
    } catch (error) {
      status.textContent = error.message || "Please try again.";
    } finally {
      button.disabled = false;
    }
  });
</script>

Connect your own form

Replace the example origin and access key with the values from your form’s setup screen. Send a test message from each site you publish and check the submission in your inbox.

Related resources

Connect this templateBrowse form examples