JavasScript can be used to perform some preliminary tests on the form inputs, before sending the data to server.
This takes care of erroneous information saving time for both users and the server, and since the script is executed on the client side there is no excess load on the server.
The preliminary checks can be performed to check for password length, empty field, unwanted text etc.
Some validations require use of Regular Expressions for pattern matching for addresses, zip codes, phone numbers etc. We learn more about it in further chapters.
Some form fields are mandatory and require an input from the user before the form is submitted