Form Validation made easy!

Been thinking about this for years and I finally did it. My last form job drove me bonkers (largely due to those pesky radio inputs) but for one reason or another, validating never seemed proper to me. I’m sure someone else has done this, and probably even better, but what they forgot to do was share afterwards. I had to dig this information up.

1 Like

Any chance of sharing the actual code?

1 Like

All browsers has a built in form validation, no need to invent the wheel again

Here is a short list to some of the most common pattern

One thing to remember though about frontend validation like this is that users can simply edit their page using Dev tools to send invalid information. In this case it will happily be accepted by the backend without server side validation causing all sorts of issues.

Using frontend validation helps browsers and accessibility. But if any information is being sent to a database or similar. Always have backend validation too.

This JS code can provide more reliable validation, thank you for sharing it with us!