Form Validation for Bootstrap in Netlify

Greetings – I am a reasonable noob to Netlify. I have been able to get site hosting working without issue, deployment, etc. All is good.

The challenge is forms. I am downloading free Bootstrap themes and that all have their own validation js files and some sort of PHP mailer. I am only interested in using Netlify to send and collect form data.

It seems like I need to “walk away” from the built-in form validation and use some open solution.

I am NOT a js coder, but I can hack solutions together if there are decent docs and it’s not too hard.

What is the best library I can use for form validation that would be easy to bolt onto an existing form? I am looking for something that is pretty industry standard and used by the Netlify community.

Many thanks for any insight.

It depends on what kind of validiations you want to perform and then if the library size worth the tradeoff because if you are going to use only a very limited subset, then the entire library might be an overkill. So if you can explain what kind of validiations you’re looking for, someone here might be able to put together a simple code sample.

About the library part, a quick Google Search mentioned these libraries in top: https://formvalidation.io/, https://parsleyjs.org/

@hrishikesh Thanks for the suggestions

After spending too much time on Google, it seems like the best option may just be to use the built in validation in Bootstrap and keep things real simple.

The site is only collecting:

  • name
  • email address
  • telephone
  • message

Can anyone let me know the easiest way to check the email field.

For errors, I guess I am just going to put a red border around the field with no warning text.

This is a VERY low traffic site and the built in Netlify success modal should work fine.

If you want to check just the format of email, that is if it’s entered in user@example.com format or not, then HTML5 alone works great: <input type = "email" required> works great.

Thanks. I think I wrapped this up by just not being lazy and looking for too much solution for not enough problem.

The easiest way to solve was to strip out the original crap from the template author and just get the raw form. Then add basic HTML5 validation and then problem solved.