A WordPress contact form that works without JavaScript
A form built as plain HTML, with JavaScript only as an improvement, keeps working when a script fails to load, is blocked by an extension, or breaks because of another plugin. Many form plugins send only through JavaScript, so any script error on the page means messages silently stop.
How often JavaScript doesn't run
It's not just people who switch it off. A slow connection that times out, a content blocker, an old browser, or an error in another plugin's script on the same page can all stop a form's script. A form that depends on it then does nothing when Send is pressed — or looks like it sent when it didn't.
How the fallback works in Mailbag
Every Mailbag form is an ordinary HTML form that posts to the page it's on. With JavaScript, the script sends it in the background and shows the result without reloading. Without JavaScript:
- On success, the server saves the entry and answers with a redirect (HTTP 303) back to the same page, which then shows the thank-you message. Because of the redirect, refreshing the page doesn't send the form twice.
- On an error, the page is drawn again with a summary of what to fix at the top, each problem linked to its field, and everything the visitor typed still filled in.
Both paths go through the same code on the server — the same checks, spam protection and mail — so neither is a second-class version.
Testing it yourself
- Open your contact page in a browser with JavaScript switched off (in Chrome: Settings → Privacy and security → Site settings → JavaScript).
- Send the form with a required field empty: you should see the error summary and your text still there.
- Fill it in and send: you should see the thank-you message, and the entry under Mailbag → Entries.
- Refresh the page: no second entry should appear.
What JavaScript adds
With scripts on, the form sends without a page reload, locks the button while sending and shows Sending…, and fetches a fresh security token when a visitor starts typing on a page that came out of a cache.
Mailbag Contact Form is a free contact form that saves every entry before it sends anything, and shows you what happened to each email.
See what it does