Validating data input directly within the context of the web browser both improve the user experience and reduce the workload of your web server.
Validating the input of a textbox reduces the odds of errors by accepting only precise data format of dates or phone number while accompanying the user as he/she types on his/her keyboard.
The data validation, with either function (such as when you want to validate barcodes) and regular expressions, allow validating the user input a second time before sending the data to the web-server in order to be validated a third time, processed, and saved.
In this tutorial, I will teach this dual validation strategy allowing you to reduce input errors while maximizing the user experience. Now, we got to be careful because over restrictive validations can be frustrating for your legitimate users if they cannot type valid data such as their own postal code or their email address.
This tutorial in two parts will teach you:
– How to improve the basic textboxes existing in HTML5
– How to evaluate which controls are supported by which web browser.
– How to implement validations when none are offered by default.
– How to evaluate the pertinence of functionality in terms of costs and development time versus the return on investment.
– How to implement simple but efficient validations when you don’t have much time to invest on a given functionality.
– How to implement complex validations through concrete examples.
– How to determine when excessive validation becomes counter-productive and reduce the user-experience to such an extent that prospect and full-fledged customers give-up doing business with you.
– How to evaluate properly how much effort should be invested to maximize the end result while minimizing the development time (and management time afterward).
In this first part (beginner), we will explore the following examples:
– The positive and negative integers.
– The positive and negative floating numbers.
– Three examples of alphabetic validations.
– Four examples of the popular numeric barcode with their validation algorithms.
– A few examples of date validation (YYYY-MM-DD, DD-MM-YYYY and MM-DD-YYYY) and time validation (both in 12- and 24-hours format).
You can use freely all the presented source code in all your personal and professional projects without any restriction or copyright. This project represents about 30 hours of development for a seasoned programmer.
If this tutorial was useful, don’t hesitate to like, comment, and share it with your friends.
PS: Don’t simply download the source code. Don’t get disappointed just because I am not a native English speaker. Watch the whole video! I give you hundreds of dollars of recommendation and advice (not included in the source code) about software project management and software commercialization freely during my tutorials. Enjoy it!
Thank you and have a nice day,
Jonathan Parent-Lévesque from Montréal