- Some input fields cannot be empty.
- Some values must be in a particular length range.
- Some input fields must match (for example, password fields). These are some basic rules that you can make.
- Validations are just simple things like making fields mandatory.
With the help of validations, we can achieve a lot. We can show the message to the client. You can display this message in the alert box as an error.
So when all fields are filled accurately the user will able to submit the form means add the data otherwise it will show errors. Purpose of validations is to make sure that data must be correct before submitting the form if the user forgets to add anything.
Here I will take a simple example of the student registration form which contains different types of buttons like radio, reset, submit. So that you can get full overview of the validity of the form.