This article will explain some basics about form validation and then illustrate how to validate form fields using j Query.
There are two types of validation: client side validation and server side validation.
It helps you provide your users with feedback on their form submission before sending it to your server.
It saves you bandwidth, server load and it saves time for your users.
It will accept the current values of the fields and returns us the JS Bin on If you look at the JS Bin above, you may notice something odd.
The 'Date Expression Compare' validator compares the value of a date field with a date expression (for example, date field must be more recent than actual date).
If your validator function takes 2 arguments, mongoose will assume the 2nd argument is a callback.If the built-in validators aren't enough, you can define custom validators to suit your needs.Custom validation is declared by passing a validation function.In future, if we decide we need to store the reason something was invalid, we can replace true/false here with a string containing an error message.Now that we know how we want to display the errors AND know how to represent them, there’s something crucial missing.