Form previewSubmissions stay in this preview

Use this template

Change the project choices to match your services. The final POST includes all named fields from both steps.

Copy the code

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.

HTML
<form id="survey" action="https://api.bitebrake.com/api/submit" method="post">
  <input type="hidden" name="access_key" value="YOUR_FORM_ACCESS_KEY">
  <fieldset>
    <legend>Step 1 of 2</legend>
    <label>What are you building? <select name="project" required><option value="">Choose one</option><option>Website</option><option>App</option><option>Something else</option></select></label>
    <button type="button" data-step="1" hidden>Continue</button>
  </fieldset>
  <fieldset>
    <legend>Step 2 of 2</legend>
    <label>Work email <input name="email" type="email" autocomplete="email" required></label>
    <button type="button" data-step="-1" hidden>Back</button>
    <button type="submit">Send inquiry</button>
  </fieldset>
  <div hidden><label>Leave empty <input name="botcheck" tabindex="-1" autocomplete="off"></label></div>
</form>

<script type="module">
  const form = document.querySelector("#survey");
  const steps = [...form.querySelectorAll("fieldset")];
  let current = 0;

  function showStep(index, focus = true) {
    current = index;
    steps.forEach((step, position) => { step.hidden = position !== current; });
    steps[1].disabled = current === 0;
    if (focus) steps[current].querySelector("input, textarea, select, button")?.focus();
  }

  form.querySelectorAll("[data-step]").forEach((button) => { button.hidden = false; });
  showStep(0, false);

  form.addEventListener("click", (event) => {
    const next = event.target.closest("[data-step]");
    if (!next) return;
    const direction = Number(next.dataset.step);
    if (direction > 0) {
      const invalid = steps[current].querySelector(":invalid");
      if (invalid && !invalid.reportValidity()) return;
    }
    showStep(current + direction);
  });

  form.addEventListener("keydown", (event) => {
    if (current !== 0 || event.key !== "Enter" || !event.target.matches("input")) return;
    event.preventDefault();
    steps[0].querySelector('[data-step="1"]').click();
  });
</script>
Connect this templateBrowse form templates