Book
Submodule 9.3: Form validation
Submodule 9.3: Form validation
Completion requirements
View
- HTML validation
- JavaScript validation
1. The idea!
The main reason why we use JavaScript in forms is to enable us to perform accurate validation of the user input. It is important to ensure that the information entered is in the correct format and complete. Commonly forms have required fields, fields that need an email address and fields where the user has to enter twice matching information ( ie password fields). In all these cases, it is important that the user is informed immediately about the requirements and whether he has fulfill them, rather than after submitting the form.
HTML5 it is very useful for form validation, however, there are some fields where JavaScript is required.