Contact Form with Validation (Tailwind / vanilla)
Form validation that shows errors as the user types, not after they hit submit. Native HTML5 validation plus a tiny script to surface error messages inline.
Showing 'Please fill out this field' after the user submits is a worse UX than catching the error as they type. HTML5 has built-in validation primitives (required, type='email', pattern) that work in every browser — combined with the :invalid CSS pseudo-class, you get inline error indicators with zero JavaScript. Add ~20 lines of JS for custom messages and you have a production-quality validation pattern.
- →Basic contact form · 4 fields
- →HTML, JS, React, PHP, cURL outputs
- →One POST endpoint, no SDK
- →Honeypot + classifier, no CAPTCHA
See exactly what your visitors see — and you’ll receive.
Left: the rendered form, fully interactive in a sandboxed iframe. Right: the email and dashboard view that lands the moment a visitor submits.
Every submission becomes an email plus a dashboard row. The fields below are the exact payload your form will send. Reply-to is wired to the visitor’s email so hitting reply goes back to them.
Iframe is sandboxed — submit doesn’t actually fire. Get your access key to wire it up live.
Generate, embed, receive.
Three actions stand between you and your first lead. None of them require a backend, a database, or a CAPTCHA library.
Use HTML5 validation attributes
required for non-empty, type='email' for email format, pattern='\d{6}' for codes, minlength / maxlength for bounds. These give you free error states with no JS.
Style :invalid with CSS
input:invalid:not(:placeholder-shown) { border-color: red; }. That single rule turns inputs red the moment they're invalid — but only after the user has typed (placeholder-shown trick).
Custom messages in JS
Listen for 'invalid' events and call setCustomValidity('Friendlier error') to override the browser's default message. Polished forms personalise every error.
Five outputs. One backend.
HTML by default. Click open the language you ship in — every variant POSTs to the same /api/submit endpoint.
Replace YOUR_ACCESS_KEY with the key from your dashboard. That’s the only edit.
One template. Every framework.
The same field set works on every framework splitforms supports. HTML, React, Next.js, Vue, Astro, Hugo, WordPress — same POST, same backend.
Things people ask before they ship.
Direct answers, no marketing fluff. Missing one? Email hello@splitforms.com.
Ship your contact form with validation (tailwind / vanilla) in 60 seconds.
1,000 free submissions per month. No credit card. Copy the snippet, paste your access key, watch leads land in your inbox.