Good catch, and a useful instinct to generalise — "did it even run" is the first question, not the last. Worth adding one security framing while you're in here: both the browser's native checks and your own isEmail() run in the visitor's browser, so they're really UX, not a control. Anyone can post straight past them with novalidate in devtools, curl, or an intercepting proxy, so whatever receives this form server-side still needs to re-check format, length and required before it trusts or stores anything. Treat client-side validation as the convenience layer and server-side as the one that actually holds.
My Validation Code Was Fine. It Just Never Ran.
3 Comments
@[DunimeTech] Thanks, that’s a fair addition. The post only covers the UX side. Both the browser’s checks and my isEmail() run in the visitor’s browser, so neither stops anyone who posts to the endpoint directly.
On my site the form data goes to Formspree, so I don’t have server code of my own to put checks in. I haven’t looked into exactly what Formspree validates on its end, so I can’t say what it covers. That’s something I should check rather than assume.
@[Tarek-Elzoghby] Makes sense — once the endpoint is a third party, your "server-side control" is really their abuse config, so it's worth switching on what Formspree does give you: a honeypot (the _gotcha field), hCaptcha/reCAPTCHA, and domain restriction so only your origin can post to the form. They validate email format and required fields on their end, but not your business rules, so still treat every delivered submission as untrusted — especially where it lands in an email, since unescaped content in an HTML notification is a classic injection path.
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
More From Tarek-Elzoghby
Related Jobs
- Backend Software Engineer - Codex for FinanceOpenAI · Full time · San Francisco, CA
- Praktikant Architecture as Code (w/m/x)BMW Group · Full time · Germany
- Digital Product Manager (Infrastructure as Code)Allstate Foundation · Full time · Springfield, IL
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!