Form previewSubmissions stay in this preview
Use this template
The native dialog makes the page behind it inactive while open. Verify Escape, the close button, and focus return from a keyboard.
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
<button type="button" id="open-contact">Contact us</button>
<dialog aria-labelledby="contact-heading" id="contact-dialog">
<h2 id="contact-heading">Contact us</h2>
<button id="close-contact" type="button">Close</button>
<form 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" 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>
</form>
</dialog>
<script type="module">
const dialog = document.querySelector("#contact-dialog");
document.querySelector("#open-contact").addEventListener("click", () => dialog.showModal());
document.querySelector("#close-contact").addEventListener("click", () => dialog.close());
</script>