You added required to your email field, tested it once, and moved on. A week later your inbox has a submission with an empty email and a message that is just a URL. Browser validation did not fail. It was never the thing protecting you.
Form validation on a static site is the practice of checking submitted values twice: once in the visitor's browser for speed and clarity, and once on the receiving server for correctness and safety. A static site has no server of its own, so the second check has to live in whatever backend receives the POST. This article explains which rules belong where, and how to wire the two together with a hosted backend such as SimpleForm.
Why is browser-only form validation not enough?
Browser validation is not enough because the browser is controlled by the visitor, not by you. Anyone can open dev tools, delete the required attribute, or skip the page entirely and send a POST with curl. Every attribute you wrote is a suggestion to a well-behaved client.
That does not make client-side checks useless. They exist for the honest visitor who mistyped an address and would like to know before pressing send. They save a round trip, they keep the user's typed data on screen, and they are free because the browser implements them.
The mistake is treating them as a security or data-quality boundary. A useful rule: client-side validation improves the experience, server-side validation protects the data. You need both, and neither replaces the other.
What can the browser validate without any JavaScript?
The browser can validate required fields, input types, length, numeric ranges and patterns using HTML attributes alone. The MDN page on constraint validation documents the full set, and the browser blocks the submit and shows a message when a rule fails.
For a contact form, this small set covers most cases:
<form action="https://simpleform.dev/f/TOKEN" method="POST">
<input type="text" name="name" required maxlength="100">
<input type="email" name="email" required>
<textarea name="message" required minlength="10" maxlength="2000"></textarea>
<button type="submit">Send</button>
</form>The type="email" check is deliberately loose. It accepts a@b because that is a syntactically valid address on an internal network. It tells you the value has the shape of an address, not that the mailbox exists.
Keep client rules to things a user can fix in one glance. Hard rules that reject legitimate input, such as strict phone-number patterns or name length limits under 50 characters, cause more lost leads than they prevent bad ones.
Which rules belong on the client, and which on the server?
Put format and completeness rules on the client, and put anything that protects you from abuse or bad data on the server. The table below is the split we recommend for a typical contact form.
| Rule | Client (browser) | Server (backend) |
|---|---|---|
| Field is not empty | Yes, via required | Yes, reject missing data |
| Looks like an email | Yes, via type="email" | Yes, before using it as a reply address |
| Message length limits | Yes, via minlength and maxlength | Yes, bots ignore attributes |
| Bot detection | No, a hidden field only works if the bot fills it | Yes, honeypot check and rate limiting |
| Allowed origin | No | Yes, domain restriction |
| Plan or quota limits | No | Yes, only the server knows the count |
Notice that three of the six rows are server-only. Those are exactly the rules that a static page cannot enforce, because the page has no secret and no memory of previous requests.
What does a form backend validate for you?
A hosted form backend validates the parts of a request that a static page cannot see: who sent it, how often, and whether you are within your plan. According to the SimpleForm documentation, the endpoint at /f/{token} answers with a small set of status codes, and each one is a validation outcome.
- 400 means the form data was missing or invalid.
- 402 means your plan's monthly submission limit has been exceeded.
- 403 means the request came from a disallowed origin domain.
- 404 means the endpoint token was not found or is inactive.
- 429 means the rate limit was exceeded.
SimpleForm applies a hidden honeypot field and an IP rate limit of 10 submissions per IP per hour per endpoint on every plan. A honeypot hit returns 200 on purpose, so a bot gets no signal that it was caught. This is why you cannot rely on the status code alone to know a submission was stored.
You can write the manual version of this yourself with a serverless function, checking origin, counting requests and storing state somewhere. At that point you are maintaining a small backend for a contact form. SimpleForm exists so that the second layer of validation is already running behind your action URL, and the documentation lists every response code and option.
How do you show both kinds of failure in the page?
Show client failures with the browser's built-in messages or the Constraint Validation API, and show server failures by reading the response status after a fetch call. These are two separate code paths, and treating them as one is the most common source of confusing error messages.
Follow these steps to wire both:
- Add HTML validation attributes to every field, and leave the browser's default blocking behaviour on.
- Intercept the submit event, call
event.preventDefault()and then sendnew FormData(form)withfetch, setting theAccept: application/jsonheader. - Check
res.statusbefore parsing the body, and map 400, 403, 429 and 402 to distinct, human-readable messages. - On a successful response, check
data.success, reset the form and show a confirmation. - On a network error, keep the typed values, show a retry message and do not clear the form.
A compact version of step 3 looks like this:
const messages = {
400: 'Please check the highlighted fields and try again.',
403: 'This form is not enabled for this site.',
429: 'Too many attempts. Please wait a while and try again.',
402: 'We cannot accept messages right now. Please email us instead.'
};
const res = await fetch(form.action, {
method: 'POST',
headers: { 'Accept': 'application/json' },
body: new FormData(form),
});
if (!res.ok) {
showError(messages[res.status] || 'Something went wrong.');
return;
}
form.reset();Notice that the 403 and 402 messages are written for the visitor, not for you. A visitor cannot fix a disallowed origin or an exhausted quota, so tell them what to do next and log the details somewhere you will see them.
What is the most common validation mistake on static forms?
The most common mistake is trusting the success response as proof that a real person submitted valid data. A 200 can mean the submission was stored, or it can mean a honeypot field was filled and the request was quietly dropped. Neither says the email address is deliverable.
The practical consequence: if the reply address matters, validate it by acting on it. Send a short auto-reply to the address, and treat a bounce as the real validation result. Confirmation by email is the only check that proves the mailbox exists.
The second most common mistake is over-strict client rules. A regular expression for names or phone numbers that rejects an apostrophe, a plus sign or a non-Latin character quietly turns away real people. Prefer accepting too much on the client and sorting it out when you read the submission.
Will server-side validation cost you submissions?
Server-side validation will not cost you legitimate submissions, but rejected requests may still count against rate limits, and over-limit requests are not stored. The pricing page states that submissions over your monthly limit return a 402 and are not stored, and that the Free plan includes 100 submissions per month and 3 forms.
If the worry is that a strict backend will block real users, the honest answer is that the rules above are narrow: a missing field, a wrong origin, or more than 10 requests from one IP in an hour. Ordinary visitors do not hit them. If you expect more volume or want reCAPTCHA v3 and domain restriction, the pricing page shows which plan includes each.
Next step: add the second layer
Create a free endpoint, paste its URL into your form's action attribute, and send one deliberately invalid request with curl to see the response code your page will have to handle. It takes a few minutes, and you will see the rejection before your visitors do. Create a free SimpleForm endpoint and test it against the checklist above.
Frequently asked questions
Yes. HTML attributes only run in the visitor's browser, which anyone can bypass with dev tools or a direct POST request. They give honest users fast feedback, but they do not protect your data. A backend that rejects missing data, wrong origins and excessive requests is what actually enforces the rules.
Yes. Use HTML attributes for browser checks and a hosted form backend for the rest. You point the form's action attribute at the backend URL, and it handles origin checks, rate limiting and spam filtering. You only write the front-end code that reads the response status and shows the right message.
A 400 response means the server received the request but the form data was missing or invalid. Check that every required field has a name attribute, that the content type matches what you sent, and that the body is not empty. Fix the data on the client and send the request again.
No. It only checks that the value has the shape of an email address, and it accepts addresses like a@b. To confirm that a mailbox exists, send a message to it, such as an auto-reply, and watch for a bounce. Delivery is the only reliable validation.
A 200 status can be returned when a honeypot field was filled, because the backend deliberately gives bots no signal that they were caught. Check that you are not auto-filling a hidden field with a browser extension or script, and confirm the submission against your dashboard rather than the status code.