Where this goes
Use the HTML form below with id="contact" and add <p id="status" role="status"></p> after it, then load the script with defer.
Create a form in the dashboard and replace YOUR_FORM_ID with your endpoint ID. No account key belongs in this code.
<form action="https://formdrop.wouldairecommend.workers.dev/f/YOUR_FORM_ID" method="POST">
<label for="email">Email</label>
<input id="email" type="email" name="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
<input name="_gotcha" tabindex="-1" autocomplete="off" hidden>
<button type="submit">Send message</button>
</form>
// Load this in a separate script file:
const form = document.querySelector('#contact');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const status = document.querySelector('#status');
const button = form.querySelector('button');
button.disabled = true;
try {
const response = await fetch('https://formdrop.wouldairecommend.workers.dev/f/YOUR_FORM_ID', {
method: 'POST', body: new FormData(form),
headers: { Accept: 'application/json' }
});
const result = await response.json();
if (!response.ok) throw new Error(result.message || 'Could not send.');
status.textContent = 'Message received. Thank you!';
form.reset();
} catch (error) { status.textContent = error.message; }
finally { button.disabled = false; }
});The detail that matters
Do not set Content-Type when sending FormData: the browser generates its multipart boundary.
After you publish
Send a test from the published page, then check Inbox and Spam. Native forms follow a redirect; fetch clients must request JSON and show errors. Set your allowed domains to the hostnames you actually publish, including any preview hostname you need.
Read the endpoint reference for reserved fields, CORS and redirect rules. Start from the accessible contact template if you need styling.